A Laravel package generator that streamlines the process of creating standardized package structures. Quickly bootstrap your packages with a complete, well-organized structure and focus on building functionality rather than configuration.
- Generates a complete Laravel package structure with a single command
- Creates standard Laravel package directories (config, migrations, views, etc.)
- Sets up composer.json with proper autoloading and dependencies
- Creates a Service Provider with common Laravel integrations pre-configured
- Includes testing setup with PHPUnit
- Generates license, readme, and other essential files
You can install the package via composer:
composer require rayiumir/laravel-package
After Publish Config Files:
php artisan vendor:publish --provider="Rayiumir\LaravelPackage\ServiceProvider\PackageServiceProvider"
The service provider will be automatically registered for Laravel 5.5+. For older versions, add the service provider manually:
// config/app.php
'providers' => [
Rayiumir\LaravelPackage\ServiceProvider\PackageServiceProvider::class,
];
Generate a new package with the following command:
php artisan make:package my-package
This will create a new package in the packages/my-package
directory with the default vendor name.
You can specify a custom vendor name:
php artisan make:package my-package --vendor=acme
To include PHPUnit test setup:
php artisan make:package my-package --with-tests
The generated package will have the following structure:
packages/my-package/
├── config/
├── database/
│ └── migrations/
├── resources/
│ ├── lang/
│ └── views/
├── routes/
├── ServiceProvider/
│ └── PackageNameServiceProvider.php
├── tests/ (if --with-tests option is used)
│ ├── Feature/
│ ├── Unit/
│ └── TestCase.php
├── composer.json
├── LICENSE.md
├── README.md
└── phpunit.xml
After generating your package, you might want to:
- Edit the
composer.json
file to update package details and requirements - Modify the Service Provider to add any specific functionality
- Update the README.md with your package documentation
- Add your migrations, routes, and views
- Create your package's main classes in the
src
directory - If you used the
--with-tests
option, start writing tests for your package
When developing the package locally within a Laravel application, you can add the repository to your application's composer.json
:
"repositories": [
{
"type": "path",
"url": "./packages/my-package"
}
]
If you generated your package with the --with-tests
option, you can run tests with:
cd packages/my-package
composer install
vendor/bin/phpunit
Once your package is ready, you can publish it to Packagist:
- Push your package to GitHub or another Git repository
- Register your package on Packagist
- Set up webhooks for automatic updates when you push changes
Command Install | Folders and Files |
---|---|
![]() |
![]() |
Contributions are welcome! Please feel free to submit a Pull Request.
If you have any questions or need help, please:
- Open an issue on GitHub