Passing Route Data to Laravel Blade Templates
When a Laravel web route needs to display information from its URL, the route or its controller must pass that information to…
If you keep a PHP library in a public Git repository, you can publish it on Packagist so other developers can find and install it with Composer. Composer is PHP’s dependency manager. Packagist catalogs packages and tells Composer where to download their code, and Composer uses Packagist by default, so most developers don't have to add another repository to install your package.
Start by putting a valid composer.json file at the root of your repository. Submit the public repository URL to Packagist, and then publish releases by adding Git tags. Pick your package name carefully before you submit it, because Packagist doesn't let maintainers change the name later. If your code needs to stay private, use a private Composer repository instead of public Packagist.
Before you submit the repository, make sure it is public and holds the library code you want to distribute. Packagist reads Composer metadata from the repository’s root. If you only put composer.json inside a subdirectory, Packagist won't treat the repository as an ordinary package.
Choose a package name in vendor/project form, such as acme/email. Use lowercase letters, and separate words with hyphens, periods, or underscores. Before you settle on a name, search Packagist to see which packages already exist and who owns the vendor name. Packagist treats the published package name as permanent and protects vendor names once someone publishes a package under them. To publish under an existing vendor name, you need permission and you must already maintain at least one package under that vendor. If you don't have an established vendor identity, Composer suggests using a GitHub username as a vendor name. You can read more in Packagist’s naming guidance and Composer’s package-name rules.
If someone else owns the vendor name or disputes package ownership, Packagist won't necessarily transfer it automatically. In that case, use Packagist’s support routes for vendor claims and package transfers.
The composer.json file at the root of your repository tells Composer what the package is, which PHP versions and extensions it needs, and how to load its classes. A published library needs at least a package name and a description. Other fields help people find the package and figure out how to use it.
If your library uses namespaces, add a PSR-4 autoload mapping. PSR-4 maps a PHP namespace prefix to a directory in your package, so make sure the prefix, directory, and class file paths match your repository layout. Composer recommends PSR-4 because you don't have to regenerate the autoloader when you add a new class.
List your runtime dependencies in require, including the PHP version and any extensions your library needs. Set version constraints that match the versions you have actually tested. Composer notes that most PHP extensions do not expose version information, so use * for an extension unless you know a useful version constraint. Add license, authors, keywords, and homepage fields when they apply. Composer defaults type to library, so you can leave that field out for an ordinary library. Special package types need a compatible installer. Packagist’s metadata example shows how these fields fit together, and the Composer schema lists all accepted fields.
Check your metadata before submitting:
composer validate
Fix any syntax or schema problems the command reports, then commit composer.json to your repository. Keep in mind that composer validate only checks the manifest. It doesn't test whether your PHP code works, so run your library's tests separately. Composer recommends committing composer.lock for the library’s own development so maintainers test against fixed dependency versions. That lock file doesn't force downstream users to install those same versions; their projects resolve dependencies using the constraints in your composer.json.
Create a Packagist account or sign in, open the submission page, and enter your public repository URL. Packagist scans the repository for Composer metadata and version-control references. Once it finishes, check the package page to confirm that the name and metadata look right.
Packagist scans a new package, updates its search index, and makes the package visible to Composer clients on separate schedules. Packagist says it scans new packages right after submission when JavaScript is enabled, and updates its search index every five minutes. Composer’s troubleshooting documentation notes that a new package can take up to one minute to appear in Composer. Because these are separate stated timings, clients may not all see a new package by a fixed deadline. See Packagist’s publishing details and Composer’s troubleshooting guidance for more detail.
When you host a library in Git, Composer reads versions from your Git tags and branches. A tag marks a specific release, while a branch points to code that keeps changing. Use version tags such as 1.0.0 or v1.0.0, and follow Semantic Versioning so users know how much a release changes. Composer treats tags as releases and branches as development versions, and it can strip a leading v when it reads a tag. Don't add a version field to composer.json for a package hosted in version control, because that field can conflict with the versions Composer infers from your tags. See Composer’s version rules for the full details.
Never change a stable version after you publish it. Packagist locks the source and distribution references for stable, non-development versions once they are published. If you rewrite or move the Git tag, Packagist won't update those references. When a release has a mistake, publish the fix under a new version instead of moving the old tag. Development branches continue to track their branch as usual.
Packagist updates existing packages through supported repository hooks. Set up the integration for your Git hosting provider so each push tells Packagist to scan the repository. Without an automatic update hook, Packagist says it scans existing packages weekly. With a hook, Packagist scans whenever maintainers push, or at least monthly if a scan failed. These are Packagist’s stated operating details rather than a guaranteed deadline for an update to appear everywhere. If an update doesn't show up, check the package page and confirm that the expected tag or branch exists in your repository.
Don't give dependency-update jobs access to release or test credentials. Composer recommends that continuous integration (CI) jobs running composer update or composer update --prefer-lowest have no access to secrets or repository write permissions, because those commands install dependency versions that the lock file doesn't fix. Composer also advises against running composer update during build or release steps and suggests considering a dependency cooldown. For library development, your CI can test both current dependency versions and the lowest versions your constraints allow.
Packagist allows up to 10 maintainers per package and requires at least one. If you move a repository after its package becomes widely used, Packagist disables direct repository URL changes, so you will need to contact Packagist with the new location instead. Its API documentation covers maintainer limits, and its contact page explains how to handle repository changes.
If Composer can't find your package, check the package name for typos first and verify that a valid composer.json sits at the repository root. Next, check that the repository has the tag or branch you expect. A consumer’s stability settings can exclude development versions, so Composer may refuse to install a package that only has a branch and no stable release.
If Composer finds the package but picks an unexpected version, inspect the consumer’s version constraint and dependency graph. Composer selects versions based on the package’s tags, branches, and declared constraints, so a valid Packagist listing doesn't mean every consumer’s constraints will allow the same release. The Composer version guide explains how Composer interprets those references.
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