shakib53626/laravel-repository-maker

The shakib53626/laravel-repository-maker package provides a simple and efficient way to implement the Repository Design Pattern in Laravel projects. With a custom Artisan command (make:repository), developers can automatically generate repository classes with pre-defined methods like index, store, u

dev-master 2024-12-14 06:09 UTC

This package is auto-updated.

Last update: 2025-06-14 07:22:49 UTC


README

License

The Laravel Repository Maker package provides a simple and efficient way to implement the Repository Design Pattern in Laravel projects. With a custom Artisan command (make:repository), developers can automatically generate repository classes with pre-defined methods like index, store, update, and delete.

This tool is designed to enhance modularity, promote clean architecture, and save development time.

Installation

You can install the package via Composer.

  1. Run composer require to require the package:
    composer require shakib53626/laravel-repository-maker:dev-master

Usage

Once the package is installed, you can use the custom Artisan command to generate repository classes.

To generate a new repository, run:

php artisan make:repository TestRepository

This command will create a UserRepository class in the app/Repositories directory with default methods.

Generated Repository Structure

The generated repository class will include the following methods:

  • index(): Logic for listing resources
  • store(): Logic for storing a new resource
  • show(): Logic for displaying a single resource
  • update(): Logic for updating a resource
  • delete(): Logic for soft-deleting a resource
  • trashList(): Logic for listing trashed resources
  • restore(): Logic for restoring a trashed resource
  • permanentDelete(): Logic for permanently deleting a resource

Configuration

This package doesn't require any configuration out of the box. However, you can customize the generated repository methods according to your needs.

License

This package is licensed under the MIT License. See the LICENSE file for more information.

Contributing

If you'd like to contribute to the package, feel free to fork the repository and submit a pull request.

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/your-feature).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature/your-feature).
  5. Create a new Pull Request.

Author