jeroen-g / laravel-packager
A cli tool for creating Laravel packages.
Requires
- php: ^8.2
- ext-json: *
- ext-zip: *
- guzzlehttp/guzzle: ^7.0|^8.0
- illuminate/support: ^11.0|^12.0|^13.0
Requires (Dev)
- infection/infection: ^0.29|^0.31
- larastan/larastan: ^3.1
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.2|^10.0|^11.0
- phpstan/phpstan-mockery: ^2.0
- phpunit/phpunit: ^10.5|^11.5.3
- slevomat/coding-standard: ^8.0
- symplify/easy-coding-standard: ^13.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-09 16:43:54 UTC
README
This package provides you with a simple tool to set up a new package and it will let you focus on the development of the package instead of the boilerplate. If you like a visual explanation check out this video by Jeffrey Way on Laracasts.
Requirements
Packager 3 requires PHP 8.2 or higher and Laravel 11, 12 or 13. Use Packager 2 for older versions.
Installation
Via Composer
composer require jeroen-g/laravel-packager --dev
Package auto-discovery takes care of registering the service provider.
Be aware that the auto-discovery also means that this package is loaded in your production environment. Therefore you may disable auto-discovery and instead put in your AppServiceProvider something like this:
if ($this->app->environment('local')) { $this->app->register('JeroenG\Packager\PackagerServiceProvider'); }
Optional you can publish the configuration to provide a different service provider stub. The default is here.
php artisan vendor:publish --provider="JeroenG\Packager\PackagerServiceProvider"
Available commands
New
Command:
php artisan packager:new my-vendor my-package
Result: The command will handle practically everything for you. It will create a packages directory, creates the vendor and package directory in it, pulls in a skeleton package, sets up composer.json and creates a service provider.
Options:
php artisan packager:new my-vendor my-package --i php artisan packager:new --i
The package will be created interactively, allowing to configure everything in the package's composer.json, such as the license and package description.
php artisan packager:new my-vendor/my-package
Alternatively you may also define your vendor and name with a forward slash instead of a space.
Remarks: The new package will be based on this custom skeleton. If you want to use a different package skeleton, you can either:
- (A) publish the configuration file and change the default skeleton that will be used by all
packager:newcalls. - (B) use the flag
--skeleton="http://github.com/path/to/archive/master.zip"with your own skeleton to use the given skeleton for this one run instead of the one in the configuration.
Get & Git
Command:
php artisan packager:get https://github.com/author/repository php artisan packager:git https://github.com/author/repository
Result:
This will register the package in the app's composer.json file.
If the packager:git command is used, the entire Git repository is cloned. If packager:get is used, the package will be downloaded, without a repository.
Options:
php artisan packager:get https://github.com/author/repository --branch=develop php artisan packager:get https://github.com/author/repository my-vendor my-package php artisan packager:git https://github.com/author/repository my-vendor my-package
It is possible to specify a branch with the --branch option; packager:get downloads the default branch of the repository otherwise. If you specify a vendor and name directly after the url, those will be used for the directory in packages/ instead of the last two parts of the url (author/repository in the examples above). packager:git accepts any url that git can clone, such as a git@github.com:author/repository.git or a local file:///path/to/author/repository.git; provide the vendor and name when its path has fewer than two parts. Composer installs the package by the name in its composer.json.
Tests
Command:
php artisan packager:tests
Result:
Packager will go through all maintaining packages (in packages/) and publish their tests to tests/packages.
Add the following to phpunit.xml (under the other testsuites) in order to run the tests from the packages:
<testsuite name="Packages"> <directory suffix="Test.php">./tests/packages</directory> </testsuite>
Options:
php artisan packager:tests my-vendor my-package
Remarks: If a tests folder exists, the files will be copied to a dedicated folder in the Laravel App tests folder. This allows you to use all of Laravel's own testing functions without any hassle.
List
Command:
php artisan packager:list
Result:
An overview of all packages in the /packages directory.
Options:
php artisan packager:list --git
The packages are displayed with information on the git status (branch, commit difference with origin) if it is a git repository.
Remove
Command:
php artisan packager:remove my-vendor my-package
Result:
The my-vendor\my-package package is removed from the app's composer.json (with composer remove) and its directory is deleted. You will be asked whether the vendor directory should be removed as well, which only happens when it is empty.
Enable & Disable
Command:
php artisan packager:disable my-vendor my-package php artisan packager:enable my-vendor my-package
Result:
packager:disable removes the package from the app's composer.json without deleting its files, so you can temporarily work without it. packager:enable registers it again as a path repository and requires it.
Publish
Command:
php artisan packager:publish my-vendor my-package https://github.com/my-vendor/my-package
Result:
The my-vendor\my-package package will be published to Github using the provided url.
Issues with cURL SSL certificate
It turns out that, especially on Windows, there might arise some problems with the downloading of the skeleton, due to a file regarding SSL certificates missing on the OS. This can be solved by opening up your .env file and putting this in it:
CURL_VERIFY=false
Of course this means it will be less secure, but then again you are not supposed to run this package anywhere near a production environment.
Issues with timeout
All composer and git commands that Packager runs (for example installing a package or cloning and pushing a repository) are stopped after the number of seconds in the timeout config variable, which defaults to 60. On slow connections or for large repositories you can increase it in config/packager.php.
Upgrading from 2.x to 3.0
- Packager now requires PHP 8.2+ and Laravel 11, 12 or 13.
- The
packager:checkcommand has been removed, because the SensioLabs security checker it relied on is abandoned. Runcomposer auditin the package directory instead. gitcommands ofpackager:gitandpackager:publishnow respect thetimeoutconfig variable.packager:publishpushes the current branch instead ofmaster.packager:getdownloads the default branch of the repository instead ofmasterwhen no--branchis given.- Bitbucket is no longer supported: the
--hostoption ofpackager:gethas been removed. - If you extended Packager's classes: the
FileHandlertrait is now aFileHandlerclass implementingFileHandlerInterface, its path methods take the vendor and package as arguments, the interface has new methods that your own implementation must provide, andConveyoris a final class that is resolved from the container. See pull request #152 for all changes.
Changelog
Please see changelog.md for what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Credits
License
The EU Public License. Please see license.md for more information.