Download the PHP package danilowa/laravel-factory-seeder-generator without Composer
On this page you can find all versions of the php package danilowa/laravel-factory-seeder-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download danilowa/laravel-factory-seeder-generator
More information about danilowa/laravel-factory-seeder-generator
Files in danilowa/laravel-factory-seeder-generator
Package laravel-factory-seeder-generator
Short Description A Laravel package to automatically generate factories and seeders based on models and their relationships.
License MIT
Homepage https://github.com/DaniloWA/laravel-factory-seeder-generator
Informations about the package laravel-factory-seeder-generator
Optimize Your Database Seeding with Laravel Factory Seeder Generator!
This package simplifies the creation of structured factories and seeders in Laravel applications, allowing developers to generate consistent and realistic test data with ease. It intelligently handles model attributes, including customizable data generation options and smart handling of casts. With features for logging, error handling, and extensive configuration options, this tool is essential for enhancing productivity and maintaining organized code in your development workflow.
π Index
- Overview
- Features
- Requirements
- Installation
- How It Works
- Configuration
- Command Overview
- Usage Examples
- Advantages
- Conclusion
- Contributing
- License
- Contact
π Overview
The Laravel Factory Seeder Generator is an advanced tool designed to streamline the generation of factories and seeders within Laravel applications. This package automates the creation of seeding files, significantly enhancing productivity and reducing boilerplate code during the development process.
β Features
- Automatic Generation: Effortlessly create factories and seeders for all your models, eliminating repetitive tasks and allowing for faster development cycles.
- Intelligent Data Filling: Automatically extracts all
$fillable
attributes from your models, ensuring that the correct fields are utilized for data generation. - Smart Handling of Casts: Utilizes defined casts in your model to produce realistic data with Laravel's Faker. If no casts are specified, it intelligently infers the most suitable cast for each
$fillable
field, optimizing data generation. - Seamless Integration: Integrates effortlessly with your existing Laravel project structure, requiring minimal configuration and setup.
- Customizable Options: Provides flexible configuration settings to tailor the generator to your specific development requirements.
β Requirements
To use the Laravel Factory Seeder Generator, ensure that your environment meets the following requirements:
- Laravel: This package requires Laravel 8.x or later.
- PHP: Ensure that you are running PHP 8.1 or higher.
- Faker: The package leverages the Faker library for data generation, which is included with Laravel.
π Installation
To install the Laravel Factory Seeder Generator, follow these steps:
-
Require the Package: Use Composer to add the package to your Laravel project:
- Publish Configuration (optional): If your package includes configuration files, you can publish them to your application's config directory:
π§ How It Works
-
Field Retrieval: The package scans your models to identify all fields listed in
$fillable
, garantindo que apenas os campos pretendidos sejam utilizados para geração de dados. -
Intelligent Data Generation: For each field in
$fillable
, the package generates relevant data using Laravel's Faker library. - Utilization of Casts: If your model specifies casts, the package automatically generates suitable data types.
βοΈ Configuration
The configuration file allows you to customize the behavior of the generator. Here are the key settings you can modify:
-
Custom Attributes Active: Toggle this option to enable or disable custom attributes.
-
Default Attributes Priority: When enabled, this setting takes precedence over the default Laravel casts.
-
Custom Attributes: Specify mappings for custom attributes.
-
Include Relationships in Factories: This option allows you to include related models in the generated factories.
-
Custom Seeder Count: Set the default number of records to create when generating seeders.
- Enable Logging: This option enables detailed logging for the generation process.
β‘ Command Overview
The package includes a variety of commands to facilitate the factory and seeder generation process:
- GenerateFactory: Generates a factory for a specified model.
- GenerateSeeder: Creates a seeder for a specified model.
- GenerateFactoryAndSeederCommand: Combines functionalities of both commands.
- GenerateFactoryAndSeederAllCommand: Automatically generates factories and seeders for all models in your application.
π Usage Examples
To generate all necessary files for models without factories and seeders, run:
To generate factory and seeder files for specific models, use:
To generate a factory and seeder for a particular model, execute:
π Advantages
- Efficiency: Reduces the time spent on manual factory and seeder creation.
- Consistency: Ensures that generated data is valid and consistent.
- Flexibility: Customizable settings to adapt the package to your unique development needs.
β Conclusion
The Laravel Factory Seeder Generator is an essential tool for Laravel developers looking to optimize their workflow by automating factory and seeder creation.
π€ Contributing
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature
). - Make your changes and commit them (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Open a pull request.
π License
This package is licensed under the MIT License.
π¬ Contact
For any questions or feedback, please reach out to:
- Danilo Oliveira: [email protected]
- Website: daniloo.dev
Note: This package is currently under development.