lyre / lyre
One minute CRUD with a simple command to create all resources
1.0.16
2024-05-27 22:49 UTC
Requires
- php: ^8.2
- laravel/framework: ^11.0
- laravel/tinker: ^2.9
- spatie/laravel-activitylog: ^4.8
- spatie/laravel-permission: ^6.4
README
About Lyre
Lyre is a php package built for Laravel. Lyre works together with the rich Laravel ecosystem, and goes hand in hand with its philosophy of expressive, elegant syntax. It takes enjoyable and creative development a step further and makes you feel the harmony of it all as the elements come together. Lyre utilizes the following to create the rhythm of the future:
- Repositories, as hinted at in Laravel's container docs.
- Eloquent resources to automatically transform your responses.
- Abstracted resource controllers with all your basic CRUD.
- Comes out of the box with spatie roles and permissions configured with Laravel policies.
- Another out of the box feature: spatie activity log configured with Eloquent observers.
- And finally, Artisan console commands to rule them all.
Lyre is accessible, powerful, and it is your next favorite tool.
Get started right away
composer require lyre/lyre
- Add
LyreServiceProvider
to your providers array underbootstrap
>providers.php
- Clear configuration cache
php artisan make:all Post
-
Add your columns to your migration and migrate
-
Add your model to your routes file
Route::apiResource('posts', PostController::class);
-
Consume your API!
-
Guess what? That's it.
Dependencies
Digging Deeper
Filters
Column Filters
- Easily return data filtered by a specific column
$data = $this->postRepository->columnFilters(['status' => 'active'])->all();
Range Filters
- Easily filter your data by range, for example, created_at!
$data = $this->postRepository->rangeFilters(['created' => [now()->subHours(24), now()])->all();
Relation Filters
- You can even return your data filtered by specific relationships!
$data = $this->postRepository->relationFilters('author' => 'id,1')->all();
Search Query
- Search through your repository!
$data = $this->postRepository->searchQuery(['search' => 'lyre'])->all();
Method Chaining
- What is more? You can chain all these methods to fine tune your query!
$data = $this->postRepository->columnFilters(['status' => 'active']) ->rangeFilters(['created' => [now()->subHours(24), now()]) ->relationFilters('author' => 'id,1') ->searchQuery(['search' => 'lyre']) ->all()
License
Lyre is open-sourced software licensed under the MIT license.