anandmainali / packagetemplate
Make your package development easier with package template.
Installs: 2 738
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
This package is auto-updated.
Last update: 2025-05-29 01:46:01 UTC
README
Package template helps to create a structure of package with single command. It also provides other commands to generate files just as in laravel.
Installation
Use the package manager composer to install PackageTemplate.
composer require anandmainali/packagetemplate
Enable the package (Optional)
This package implements Laravel auto-discovery feature. After you install it, the package provider and facade are added automatically for laravel >= 5.5.
Configuration
After installation, you have to publish config file.
php artisan vendor:publish --tag=package-config
This will generate package.php
file inside the config folder.
Package.php
<?php return [ /** * Main folder to holds all the packages. Contains packages with VendorName. */ 'path' => 'packages', /** * The VendorName will be generated inside the main folder. */ 'vendorName' => "VendorName", /** * These are the folders that will be generated while creating package. */ 'folders' => [ 'controllers', 'database/migrations', 'models', 'policies', 'resources/views', 'routes' ], /** * These are the files that will be generated while creating package. */ 'files' => ['routes/web'] ];
Now, you can start building your package. To generate package,
php artisan create:package PackageName
And, all the files and folders you specified in config.php
will be generated.
Other Available Commands with php artisan
Note:- The PackageName
is used to generate files inside the package.
create:model ModelName PackageName
create:controller ControllerName PackageName --r //--r is optional. It is used to create resource controller.
create:migration MigrationName TableName PackageName
create:policy PolicyName PackageName
create:command CommandName --command=command:name PackageName