larafun / suite
A collection of classes and traits that will make you Laravel API workflow even more awesome!
Installs: 2 495
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/larafun/suite
Requires
- php: ^8.0
- illuminate/contracts: ^8.0
- illuminate/database: ^8.0
- illuminate/support: ^8.0
Requires (Dev)
- orchestra/database: ^6.0
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2025-10-26 23:18:51 UTC
README
A small collection of classes and traits that will make your Laravel API development even more awesome!
Check out the full documentation in here larafun-suite.readthedocs.io
Installation
Requires PHP > 7.0, Laravel > 5.5
composer require larafun/suite
Basic Usage
Just make your Models extend Larafun\Suite\Model instead of use Illuminate\Database\Eloquent\Model
<?php namespace App\Models; use Larafun\Suite\Model; class Book extends Model { }
Now you can use your models as you regularly would.
Why use this package?
Because you get enhanced Resources and Pagination out of the box!
class BookController extends Controller { // ... public function index() { return Book::where('author', 'Isaac Asimov')->skip(2)->take(5)->get(); }
Since the Book is an instance of Larafun\Suite\Model the results will be
automatically presented inside a data property. Additionally, a meta field
will be included and provide pagination information out of the box.
Switch back to the default behaviour?
The most easy way is to make your models extend Illuminate\Database\Eloquent\Model.
Otherwise you can fine tune your setup inside config/suite.php, after you publish it:
php artisan vendor:publish --provider=Larafun\\Suite\\ServiceProvider
TODO
These things should be added:
- Add Validation to Filters
- Add Formatters to Filters
- Add Sanitizers to Filters
- Change Filters behaviour to allow keys that do not have any defined defaults
- Allow Filters to override values after instatiation
- Split Filters into a separate package