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.
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.
- Easily return data filtered by a specific column
$data = $this->postRepository->columnFilters(['status' => 'active'])->all();
- Easily filter your data by range, for example, created_at!
$data = $this->postRepository->rangeFilters(['created' => [now()->subHours(24), now()])->all();
- You can even return your data filtered by specific relationships!
$data = $this->postRepository->relationFilters('author' => 'id,1')->all();
- Search through your repository!
$data = $this->postRepository->searchQuery(['search' => 'lyre'])->all();
- 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()
Lyre is open-sourced software licensed under the MIT license.