Bagisto Package Generator will create a sample package for you with a single command
It packs in lots of demanding features that allows your business to scale in no time:
- Create package with a single command.
- Bagisto: v2.0 or higher.
Go to the root folder of Bagisto and run the following command
composer require bagisto/bagisto-package-generator
That's it, now just execute the project on your specified domain.
After setting up, you will see that there are list of package commands which help you to make your package creation smooth.
Below are the list of commands,
S. No. | Commands | Info | Required Arguments | Optional Arguments |
---|---|---|---|---|
01. | package:make | Create a new package. | package-name | --force, --plain |
02. | package:make-admin-controller | Create a new admin controller. | controller-name, package-name | --force |
03. | package:make-admin-route | Create a new admin routes file. | package-name | --force |
04. | package:make-shop-controller | Create a new shop controller. | controller-name, package-name | --force |
05. | package:make-shop-route | Create a new shop routes file. | package-name | --force |
06. | package:make-model | Create a new model class. | model-name, package-name | --force |
07. | package:make-model-proxy | Create a new model proxy class. | model-proxy-name, package-name | --force |
08. | package:make-model-contract | Create a new model contract. | model-contract-name, package-name | --force |
09. | package:make-migration | Create a new migration class. | migration-name, package-name | |
10. | package:make-seeder | Create a new seeder class. | seeder-name, package-name | --force |
11. | package:make-request | Create a new request class. | request-name, package-name | --force |
12. | package:make-middleware | Create a new middleware class. | middleware-name, package-name | --force |
13. | package:make-datagrid | Create a new datagrid class. | datagrid-name, package-name | --force |
14. | package:make-repository | Create a new repository class. | repository-name, package-name | --force |
15. | package:make-provider | Create a new service provider class. | provider-name, package-name | --force |
16. | package:make-event | Create a new event class. | event-name, package-name | --force |
17. | package:make-listener | Create a new listener class. | listener-name, package-name | --force |
18. | package:make-notification | Create a new notification class. | notification-name, package-name | --force |
19. | package:make-mail | Create a new mail class. | mail-name, package-name | --force |
20. | package:make-command | Create a new command class. | command-name, package-name | --force |
21. | package:make-payment | Create a new payment class. | payment-name, package-name | --force |
22. | package:make-shipping | Create a new shipping class. | shipping-name, package-name | --force |
23. | package:make-module-provider | Create a new module service provider class. | provider-name, package-name | --force |
24. | package:make-payment-method | Create a new payment method package. | payment-package-name | --force |
25. | package:make-payment-method-provider | Create a new payment method service provider class. | provider-name, payment-package-name | --force |
26. | package:make-shipping-method | Create a new shipping method package. | shipment-package-name | --force |
27. | package:make-shipping-method-provider | Create a new shipping method service provider class. | provider-name, shipment-package-name | --force |
28. | package:make-vite-config | Create a new vite config file. | package-name | --force |
29. | package:make-tailwind-config | Create a new tailwind config file. | package-name | --force |
30. | package:make-postcss-config | Create a new post css config file. | package-name | --force |
31. | create-a-new-theme-for-admin | Create a new theme for admin. | theme-name | --force |
--force : To overwrite the files
--plain : When you need only directory structure template, files are not included when this argument is passed
This command will generate all the necessary files which previously you create manually for your package.
php artisan package:make ACME/TestPackage
For e.g., If you want to create a package which named as 'TestPackage', then you need to use the command like this,
php artisan package:make ACME/TestPackage
This will create whole directory structure for you automatically so that you don't want to do manually like registering routes, views, etc.
If you want to do things manually only need folder structures, then there is a optional argument known as 'plain'. Below is the sample,
php artisan package:make ACME/TestPackage --plain
If somehow folder or package is already present, then simple command won't work. So to overcome this problem we need to use force command.
php artisan package:make ACME/TestPackage --force
This command will generate a new controller for your admin portion.
php artisan package:make-admin-controller AdminTestController ACME/TestPackage
If controller is already present, then you need to use the force command.
php artisan package:make-admin-controller AdminTestController ACME/TestPackage --force
If you want to create an admin route, then you need to use this command and then register your routes file in the service provider i.e. 'ACME\TestPackage\Providers\TestPackageServiceProvider'.
php artisan package:make-admin-route ACME/TestPackage
If admin routes file already present and you want to override this, then you need to use force command.
php artisan package:make-admin-route ACME/TestPackage --force
This command will generate a new controller for your shop portion i.e. 'packages/ACME/TestPackage/src/Http/Controllers/Shop'.
php artisan package:make-shop-controller ShopTestController ACME/TestPackage
If controller is already present, then you need to use the force command.
php artisan package:make-shop-controller ShopTestController ACME/TestPackage --force
If you want to create a shop route, then you need to use this command and then register your routes file in the service provider i.e. 'ACME\TestPackage\Providers\TestPackageServiceProvider'.
php artisan package:make-shop-route ACME/TestPackage
If shop routes file already present and you want to override this, then you need to use force command.
php artisan package:make-shop-route ACME/TestPackage --force
This command will create a following files,
- New model class in 'packages/ACME/TestPackage/src/Models' directory.
- New model proxy class in 'packages/ACME/TestPackage/src/Models' directory.
- New model contract in 'packages/ACME/TestPackage/src/Contracts' directory.
php artisan package:make-model TestModel ACME/TestPackage
This command will overwrite all three files.
php artisan package:make-model TestModel ACME/TestPackage --force
This command will create a new model proxy class in 'packages/ACME/TestPackage/src/Models' directory.
php artisan package:make-model-proxy TestModelProxy ACME/TestPackage
If model proxy class already present then you can use force command for overwriting.
php artisan package:make-model-proxy TestModelProxy ACME/TestPackage --force
This command will create a new model contract in 'packages/ACME/TestPackage/src/Contracts' directory.
php artisan package:make-model-contract TestContract ACME/TestPackage
If model contract already present then you can use force command for overwriting.
php artisan package:make-model-contract TestDataGrid ACME/TestPackage --force
This command will create a new migration class in 'packages/ACME/TestPackage/src/Database/Migrations' directory.
php artisan package:make-migration TestMigration ACME/TestPackage
This command will create a new seeder class in 'packages/ACME/TestPackage/src/Database/Seeders' directory.
php artisan package:make-seeder TestSeeder ACME/TestPackage
If seeder class already present then you can use force command for overwriting.
php artisan package:make-seeder TestSeeder ACME/TestPackage --force
This command will create a new request class in 'packages/ACME/TestPackage/src/Http/Requests' directory.
php artisan package:make-request TestRequest ACME/TestPackage
If request class already present then you can use force command for overwriting.
php artisan package:make-request TestRequest ACME/TestPackage --force
This command will create a new middleware class in 'packages/ACME/TestPackage/src/Http/Middleware' directory.
php artisan package:make-middleware TestMiddleware ACME/TestPackage
If middleware class already present then you can use force command for overwriting.
php artisan package:make-middleware TestMiddleware ACME/TestPackage --force
This command will create a new data grid class in 'packages/ACME/TestPackage/src/Datagrids' directory.
php artisan package:make-datagrid TestDataGrid ACME/TestPackage
If data grid class already present then you can use force command for overwriting.
php artisan package:make-datagrid TestDataGrid ACME/TestPackage --force
This command will create a new repository class in 'packages/ACME/TestPackage/src/Repositories' directory.
php artisan package:make-repository TestRepository ACME/TestPackage
If repository class already present then you can use force command for overwriting.
php artisan package:make-repository TestRepository ACME/TestPackage --force
This command will create a new service provider class in 'packages/ACME/TestPackage/src/Providers' directory.
php artisan package:make-provider TestServiceProvider ACME/TestPackage
If service provider class already present then you can use force command for overwriting.
php artisan package:make-provider TestServiceProvider ACME/TestPackage --force
This command will create a new event class in 'packages/ACME/TestPackage/src/Events' directory.
php artisan package:make-event TestEvent ACME/TestPackage
If event class already present then you can use force command for overwriting.
php artisan package:make-event TestEvent ACME/TestPackage --force
This command will create a new listener class in 'packages/ACME/TestPackage/src/Listeners' directory.
php artisan package:make-listener TestListener ACME/TestPackage
If listener class already present then you can use force command for overwriting.
php artisan package:make-listener TestListener ACME/TestPackage --force
This command will create a new notification class in 'packages/ACME/TestPackage/src/Notifications' directory.
php artisan package:make-notification TestNotification ACME/TestPackage
If notification class already present then you can use force command for overwriting.
php artisan package:make-notification TestNotification ACME/TestPackage --force
This command will create a new mail class in 'packages/ACME/TestPackage/src/Mail' directory.
php artisan package:make-mail TestMail ACME/TestPackage
If mail class already present then you can use force command for overwriting.
php artisan package:make-mail TestMail ACME/TestPackage --force
This command will create a new command class in the 'packages/ACME/TestPackage/src/Console/Commands' directory.
php artisan package:make-command TestCommand ACME/TestPackage
If command class already present then you can use force command for overwriting.
php artisan package:make-command TestCommand ACME/TestPackage --force
This command will create a new payment class in 'packages/ACME/TestPackage/src/Payment' directory.
php artisan package:make-payment TestPayment ACME/TestPackage
If payment class already present then you can use force command for overwriting.
php artisan package:make-payment TestPayment ACME/TestPackage --force
This command will create a new shipping class in 'packages/ACME/TestPackage/src/Carriers' directory.
php artisan package:make-shipping TestShipping ACME/TestPackage
If shipping class already present then you can use force command for overwriting.
php artisan package:make-shipping TestShipping ACME/TestPackage --force
This command will create a new module service provider class in 'packages/ACME/TestPackage/src/Providers' directory.
php artisan package:make-module-provider TestServiceProvider ACME/TestPackage
If module service provider class already present then you can use force command for overwriting.
php artisan package:make-module-provider TestServiceProvider ACME/TestPackage --force
This command will create a new vite config file in 'packages/ACME/TestPackage' directory.
php artisan package:make-vite-config vite.config ACME/TestPackage
If vite config file already present then you can use force command for overwriting.
php artisan package:make-vite-config vite.config ACME/TestPackage --force
This command will create a new tailwind config file in 'packages/ACME/TestPackage' directory.
php artisan package:make-tailwind-config tailwind.config ACME/TestPackage
If tailwind config file already present then you can use force command for overwriting.
php artisan package:make-tailwind-config tailwind.config ACME/TestPackage --force
This command will create a new post css config file in 'packages/ACME/TestPackage' directory.
php artisan package:make-postcss-config postcss.config ACME/TestPackage
If postcss config file already present then you can use force command for overwriting.
php artisan package:make-postcss-config tailwind.config ACME/TestPackage --force
This command will create a whole new payment package for you in 'packages/ACME/Stripe' directory.
php artisan package:make-payment-method ACME/Stripe
This command will overwrite whole directory structure.
php artisan package:make-payment-method ACME/Stripe --force
This command will create a new payment method service provider class in 'packages/ACME/Stripe/src/Providers' directory.
php artisan package:make-payment-method-provider TestPaymentMethodServiceProvider ACME/Stripe
If payment method service provider class already present then you can use force command for overwriting.
php artisan package:make-payment-method-provider TestPaymentMethodServiceProvider ACME/Stripe --force
This command will create a whole new shipment package in 'packages/ACME/FedEx' directory.
php artisan package:make-shipping-method ACME/FedEx
This command will override whole directory structure.
php artisan package:make-shipping-method ACME/FedEx --force
This command will create a new shipping method service provider class 'packages/ACME/FedEx/src/Providers' directory.
php artisan package:make-shipping-method-provider TestShippingMethodServiceProvider ACME/FedEx
If shipping method service provider class already present then you can use force command for overwriting.
php artisan package:make-shipping-method-provider TestShippingMethodServiceProvider ACME/FedEx --force
This command will create a new theme array inside 'config/themes.php' file under shop key.
php artisan package:make-shop-theme test ACME/Theme --force
This command will create a new theme array inside 'config/themes.php' file under admin key.
php artisan package:make-admin-theme test ACME/Theme --force