Install Laravel Packager via Composer
masterInstall the package as a development dependency using Composer:
composer require jeroen-g/laravel-packager --devrepository·master·Indexed 23 days ago
https://github.com/jeroen-g/laravel-packagerA developer tool for Laravel designed to simplify the creation, management, and testing of Laravel packages. It automates boilerplate setup via the `packager:new` command, allows importing existing repositories with `packager:get` and `packager:git`, and provides utilities for listing, removing, enabling, disabling, and publishing packages to GitHub. It also includes a `packager:tests` command to integrate package tests into the main Laravel testing infrastructure and a `packager:check` command for security vulnerability scanning using SensioLabs Security Checker.
Install the package as a development dependency using Composer:
composer require jeroen-g/laravel-packager --devThe packager:tests command iterates through all maintained packages in the packages/ directory and publishes their tests to tests/packages within your Laravel app. This allows you to run package tests using Laravel's testing infrastructure.
Command:
php artisan packager:testsTargeted Testing:
php artisan packager:tests my-vendor my-packageConfiguration:
To run these tests via PHPUnit, add the following suite to your phpunit.xml:
<testsuite name="Packages">
<directory suffix="Test.php">./tests/packages</directory>
</testsuite>To customize the default package skeleton used by the packager:new command, publish the configuration file:
php artisan vendor:publish --provider="JeroenG\Packager\PackagerServiceProvider"If you are using a version of Laravel older than 5.5, you must manually register the service provider in config/app.php:
JeroenG\Packager\PackagerServiceProvider::class,For Laravel 5.5+, the package is automatically discovered. If you want to prevent the package from loading in production environments, you can disable auto-discovery and register it conditionally in your AppServiceProvider:
if ($this->app->environment('local')) {
$this->app->register('JeroenG\Packager\PackagerServiceProvider');
}On Windows, downloading skeletons may fail due to missing SSL certificates. You can bypass verification by adding this to your .env file (Note: this is less secure and intended for local development only):
CURL_VERIFY=falseIf packager:new commands time out, you can increase the timeout limit in config/packager.php.
The packager:new command uses several configuration values from the packager config file to populate package placeholders. If not using interactive mode (--i), the following keys are used:
packager.skeleton: The default package skeleton to download.packager.author_name: The name of the package author.packager.author_email: The email address of the package author.packager.author_homepage: The website URL of the package author.packager.license: The license type for the package.View an overview of all packages in the /packages directory.
php artisan packager:list--git to see branch and commit information for Git repositories.Delete a package and its references in composer.json and config/app.php.
php artisan packager:remove my-vendor my-packageUse the packager:new command to scaffold a new package. This creates a packages directory, sets up the vendor/package structure, pulls in a skeleton, configures composer.json, and creates a service provider.
Basic Usage:
php artisan packager:new my-vendor my-packageAlternative Syntax:
php artisan packager:new my-vendor/my-packageOptions:
--i: Run the command interactively to configure composer.json settings like license and description.--skeleton="URL": Use a specific skeleton URL instead of the default configured in config/packager.php.Note: The default skeleton is https://github.com/jeroen-g/packager-skeleton.
Register existing repositories into your application's composer.json.
packager:get (Download only)Downloads the package without the Git history.
php artisan packager:get https://github.com/author/repository--host=bitbucket flag.--branch=name to specify a branch.php artisan packager:get <url> my-vendor my-package.packager:git (Clone repository)Clones the entire Git repository.
php artisan packager:git https://github.com/author/repositoryphp artisan packager:git <url> my-vendor my-package.Publish a package to GitHub using a provided URL.
php artisan packager:publish my-vendor my-package https://github.com/my-vendor/my-packageCheck a package for security vulnerabilities using the SensioLabs security checker.
Requirement: You must first run composer require sensiolabs/security-checker.
php artisan packager:check my-vendor my-packageThe uninstallPackage() method reverses the installation process. It removes the package as a Composer dependency and unsets the path repository configuration in composer.json.
It performs:
removePackage(): Runs composer remove vendor/package.removePathRepository(): Unsets the repository entry in composer.json using the slugified vendor and package names.addToComposer($vendor, $package) method automatically updates your project's composer.json file to include the new package in the psr-4 autoloading section. It assumes a directory structure of packages/{vendor}/{package}/src.