Download the PHP package bleuren/laravel-api without Composer
On this page you can find all versions of the php package bleuren/laravel-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bleuren/laravel-api
More information about bleuren/laravel-api
Files in bleuren/laravel-api
Package laravel-api
Short Description A package to develop APIs with Laravel using Repository and Service patterns
License MIT
Homepage https://github.com/bleuren/laravel-api
Informations about the package laravel-api
Laravel API Package
A robust Laravel package for implementing the Repository and Service patterns in your API development. This package provides a solid foundation for building scalable and maintainable APIs by separating concerns and promoting clean code architecture.
Features
- Base Repository and Service classes
- Artisan commands for generating Repositories and Services
- Automatic binding of Repositories and Services in the Service Container
- JSON response handling
- Easy integration with Laravel projects
Requirements
- PHP 8.2+
- Laravel 11.0+
Installation
-
Add the package to your Laravel project:
- Publish the package configuration (optional):
Usage
Creating a Repository
To create a new repository, use the following Artisan command:
This will create a new UserRepository
class in the app/Repositories
directory and a corresponding UserRepositoryInterface
in the app/Contracts
directory.
Creating a Service
To create a new service, use the following Artisan command:
This will create a new UserService
class in the app/Services
directory and a corresponding UserServiceInterface
in the app/Contracts
directory.
Using Repositories and Services in Controllers
After creating your repositories and services, you can use them in your controllers like this:
Extending Base Classes
You can extend the base Repository and Service classes to add custom functionality:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This package is open-sourced software licensed under the MIT license.