Working with HTTP Requests in Laravel 12
When a browser or API client sends a request to a Laravel 12 route, Laravel creates an Illuminate\Http\Request object and passes it…
When you manage PHP dependencies with Composer, you might mean one of three different things by “latest.” You might want the highest stable version number, the release published most recently, or the newest version your project can install. Those three answers often differ. A version constraint in composer.json only tells Composer which releases it is allowed to pick, so it never shows you every version a package has published.
You can run composer show --all vendor/package to inspect a package’s releases without changing your project, or run composer outdated to check for updates to packages you already have installed. Neither command installs the highest version it lists. When you run an update, Composer’s dependency solver checks your version constraints, your PHP and extension requirements, and your other dependencies to pick versions that work together.
To see every release Composer can find for a package across your project’s configured repositories, run:
composer show --all vendor/package
Composer prints the package details along with all available versions. It leaves composer.json and composer.lock untouched and installs nothing. Because Composer only checks repositories configured for your project, a missing version usually means you should check your repository configuration or wait for updated package data to appear.
Behind the scenes, Packagist serves machine-readable package and release details through its Composer v2 metadata endpoint:
https://repo.packagist.org/p2/vendor/package.json
Packagist serves development-branch metadata separately, because a branch like dev-main tracks ongoing commits instead of a fixed, tagged release. You can find the full endpoint formats in the Packagist API documentation.
If you write a script to pick the highest version number from that metadata, use Composer’s version rules instead of plain text sorting. If you sort versions as text, 2.9.0 can end up after 2.10.0 even though 2.10.0 is higher. Composer’s SemVer library gives you sort and rsort functions for this. Before you compare versions, decide whether you want to include prereleases or development versions.
When you want to see which packages in your current project have newer versions available, run:
composer outdated
You can add --direct to show only the dependencies you declared in composer.json, or add --format=json if you want JSON output:
composer outdated --direct
composer outdated --format=json
As Composer’s CLI reference explains, outdated shows installed packages alongside their available updates. That makes it handy for routine maintenance, though it will not list releases for a package your project has not installed.
Your cooldown setting also changes which releases outdated treats as installable. If you pass --cooldown-period=0, Composer skips the cooldown wait and shows those newer releases. Passing that flag still respects your version constraints and will not make an incompatible release installable.
Composer ranks releases using version rules, whereas publication time answers a different question. A package’s highest version number is not always the one published most recently. If you want the newest release by date, read the publication times in the package metadata and pick the most recent one. If you want the highest version number, compare the versions using Composer’s version rules.
This difference matters for development branches as well. A maintainer might push new commits to a branch without creating a new stable tag, so treat dev-main as a moving target rather than the newest stable release.
Keep propagation time in mind, too. According to Composer’s troubleshooting guidance, a newly published Packagist release can take up to one minute to show up in Composer. If you do not see an expected release right away, verify which repository Composer is querying and wait a moment for the metadata to refresh before assuming no newer version exists.
When you are ready to update a single package, run:
composer update vendor/package
Composer picks a version that satisfies your project’s requirements and writes that version to composer.lock. For example, the constraint ^1.2.3 allows compatible releases from 1.2.3 up to, but not including, 2.0.0. If the newest release is a version 2 release, Composer skips it.
If you want to upgrade to a new major version, update the constraint in composer.json first, then run the update and review the changes in composer.lock. When related dependencies also need to change, pass -W (--with-all-dependencies) so Composer can update those packages, including root requirements. Even when Composer resolves the dependencies cleanly, your code might still break, so run your test suite after you update.
Avoid loosening a constraint only to make Composer pick the highest available version. Composer warns that unbounded constraints like * or >=3.4 can pull in breaking releases, while bounded constraints like ^3.4 keep your compatibility range clear. You can read more in Composer’s guidance on unbound constraints.
| What you want to know | Use |
|---|---|
| Which versions Composer sees for a package | composer show --all vendor/package |
| Which installed dependencies have updates | composer outdated |
| Which release has the highest version number | Compare versions with Composer’s version rules |
| Which release was published most recently | Compare publication times in package metadata |
Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.
Take a look at vroni.com