crestapps / laravel-code-generator
An intelligent code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many on the use cases. It is shipped with cr
Fund package maintenance!
malhayek
Installs: 71 455
Dependents: 2
Suggesters: 0
Security: 0
Stars: 737
Watchers: 40
Forks: 157
Open Issues: 34
Requires
- laravel/framework: >=5.1
Requires (Dev)
- mockery/mockery: ~0.9||~1.0
- orchestra/testbench: ~3.0
- phpunit/phpunit: ^5.0||^6.0||^7.0
- dev-master
- v3.0.2
- v3.0.1
- v2.4.9
- v2.4.8
- v2.4.7
- v2.4.6
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.x-dev
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.x-dev
- v2.2.14
- v2.2.13
- v2.2.12
- v2.2.11
- v2.2.10
- v2.2.9
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.0
- v1.2.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/npm_and_yarn/docs/http-proxy-middleware-2.0.7
- dev-dependabot/npm_and_yarn/docs/multi-9f37c16f8f
- dev-dependabot/npm_and_yarn/docs/micromatch-4.0.8
- dev-dependabot/npm_and_yarn/docs/webpack-5.94.0
- dev-ma/docs
- dev-ma/bs-53
- dev-release/2.4
This package is auto-updated.
Last update: 2024-11-04 15:46:04 UTC
README
Introduction
An intelligent code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many on the use cases. It is shipped with cross-browsers compatible template, along with a client-side validation to modernize your application.
For full documentation and live demo please visit CrestApps.com
Features
- Craft clean, reusable, and highly readable code for seamless development.
- Generate complete resources effortlessly with a single command, supporting both migration and existing database scenarios.
- Streamline resource creation for all existing database tables with a single command.
- Save and recreate fields using a JSON file, ensuring adaptability to changing business needs.
- Leverage JSON-based resource files for easy regeneration, even when business rules evolve.
- Generate standard CRUD controllers with simple or form-request validation.
- Customize view templates to alter the standard look and feel of your application.
- Create models with relations for comprehensive data representation.
- Establish named routes with and without grouping for efficient navigation.
- Generate standard CRUD views to facilitate a consistent user experience.
- Smart migration engine tracks generated migrations to only create necessary ones.
- Intelligent handling of model relations to simplify development.
- Highly flexible with rich configurable options to suit diverse needs.
- Easy commands for resource-file creation, addition, or reduction.
- Full support for generating multi-language applications.
- Implement client-side validation for enhanced user interaction.
- Efficiently handle file uploading and store multiple responses in the database.
- Generate form-request to clean up controllers and boost code reusability.
- Create view layouts with and without client-side validation.
- Change templates at runtime for diverse view generation.
- Ability to generate views with or without Laravel-Collective integration.
- Seamless handling of date, time, or datetime fields.
- Automatic management of boolean fields for hassle-free development.
Installation
-
To download this package into your Laravel project, use the command-line to execute the following command
composer require crestapps/laravel-code-generator --dev
-
(You may skip this step when using Laravel >= 5.5) To bootstrap the packages into your project while using command-line only, open the app/Providers/AppServiceProvider.php file in your project. Then, add the following code to the register() method.
Add the following line to bootstrap
laravel-code-generator
to the framework.if ($this->app->runningInConsole()) { $this->app->register('CrestApps\CodeGenerator\CodeGeneratorServiceProvider'); }
Lessons
Checkout our channel on YouTube.com
Available Commands
The command in between the square brackets [] must be replaced with a variable of your choice.
-
Main commands
- php artisan create:scaffold [model-name]
- php artisan create:controller [model-name]
- php artisan create:model [model-name]
- php artisan create:form-request [model-name]
- php artisan create:routes [model-name]
- php artisan create:migration [model-name]
- php artisan create:language [model-name]
- php artisan create:mapped-resources
-
API commands
- php artisan create:api-scaffold [model-name]
- php artisan create:api-controller [model-name]
- php artisan create:api-resources [model-name]
-
API Documentations commands
- php artisan api-docs:scaffold [model-name]
- php artisan api-doc:create-controller [model-name]
- php artisan api-doc:create-view [model-name]
-
Views commands
- php artisan create:layout [application-name]
- php artisan create:views [model-name]
- php artisan create:index-view [model-name]
- php artisan create:create-view [model-name]
- php artisan create:edit-view [model-name]
- php artisan create:show-view [model-name]
- php artisan create:form-view [model-name]
-
Resource's files commands
- php artisan resource-file:from-database [model-name]
- php artisan resource-file:create [model-name]
- php artisan resource-file:append [model-name]
- php artisan resource-file:reduce [model-name]
- php artisan resource-file:delete [model-name]
-
Migration commands
- php artisan migrate-all
- php artisan migrate:rollback-all
- php artisan migrate:reset-all
- php artisan migrate:refresh-all
- php artisan migrate:status-all
Contribution
Are you interested in supporting this project and making a contribution? Here's how you can get involved:
- Begin by showing your appreciation for this package on GitHub by giving it a star.
- Share this project with others to encourage ongoing enhancements and the introduction of new features.
- Report any bugs, provide comments, share ideas, or express your thoughts about this project by creating an issue on GitHub.
- Contributors are encouraged! If you're passionate about this project, consider addressing existing issues by submitting a pull request.
- If possible, consider sponsoring the project.
What did you create with this package?
I'd love to know if your site was generated using this package and list your logo on the documentation site. Please email using my contact info found in composer.json
file.
Examples
The following example assumes that we are trying to create a CRUD called with the fields listed below.
- id
- name
- description
- is_active
Basic example - CRUD with migration
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active
The above command will create resource-file names
php artisan create:scaffold AssetCategory --with-migration
The above command will create a model , a controller
Basic example - CRUD with migration - Shortcut
php artisan create:scaffold AssetCategory --with-migration --fields=id,name,description,is_active
The above command will create resource-file names first. Then, it will create a model , a controller . This is a short way to issuing both `resource-file:create` and `create:scaffold` in one line
Basic API example - CRUD with migration
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active
The above command will create resource-file names
php artisan create:scaffold AssetCategory --with-migration
The above command will create a model , a controller
Basic example using translations for English and Arabic - with migration
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active --translation-for=en,ar
The above command will create resource-file names
php artisan create:scaffold AssetCategory --with-migration
The above command will create a model , a controller
Basic example with form-request
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active
The above command will create resource-file names
php artisan create:scaffold AssetCategory --with-form-request
The above command will create a model , a controller
Basic example with soft-delete and migration
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active
The above command will create resource-file names
php artisan create:scaffold AssetCategory --with-soft-delete --with-migration
The above command will create a model , a controller
Creating resources from existing database
php artisan create:scaffold AssetCategory --table-exists
The above command will create resource-file names . It is going to assume that the table name is called "asset_categories" in your database. If that is not the case, you can use
Then it will create a model , a controller
You may also create a resource-file from existing database separately using
php artisan resource-file:from-database AssetCategory
Creating resources from existing database with translation for English and Arabic
php artisan create:scaffold AssetCategory --translation-for=en,ar --table-exists
The above command will create resource-file names
Then it will create a model , a controller
You may also create a resource-file from existing database separately using
php artisan resource-file:from-database AssetCategory --translation-for=en,ar
Creating resources from existing database with translation for English and Arabic in two step for better control over the fields!
php artisan resource-file:from-database AssetCategory --translation-for=en,ar
php artisan create:scaffold AssetCategory
The above command will create resource-file names
Then it will create a model , a controller
s
License
"Laravel Code Generator" is an open-sourced software licensed under the MIT license