ronu / rest-generic-class
Base Class for generic restfull api in laravel
Installs: 349
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Type:vcs
pkg:composer/ronu/rest-generic-class
Requires
- php: ^8.0
- illuminate/database: ^12.0
- illuminate/http: ^12.0
- illuminate/mail: ^12.0
- illuminate/pagination: ^12.0
- illuminate/support: ^12.0
- illuminate/validation: ^12.0
Suggests
- barryvdh/laravel-dompdf: Required for exportPdf()
- maatwebsite/excel: Required for exportExcel()
- nwidart/laravel-modules: Required for module-aware permissions
- spatie/laravel-permission: Required for permission models and traits
- dev-main
- 1.6.8
- 1.6.7
- 1.6.6
- 1.6.5
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.9
- 1.5.8
- 1.5.7
- 1.5.6
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.9
- 1.4.8
- 1.4.7
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.1
- 1.2.0
- 1.1.12
- 1.1.11
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.0.9
- 1.0.8
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- v1.0.0
- dev-codex/analyze-library-for-improvements-and-defects-7xcakv
- dev-codex/analyze-library-for-improvements-and-defects-c7mvzd
- dev-codex/analyze-library-for-improvements-and-defects-40mzuo
- dev-codex/analyze-library-for-improvements-and-defects
This package is auto-updated.
Last update: 2026-01-14 22:43:14 UTC
README
Base classes and helpers to accelerate RESTful APIs in Laravel with consistent filtering, validation workflows, and optional permission tooling.
Installation
composer require ronu/rest-generic-class
Quick Start
Controller + Service
use Ronu\RestGenericClass\Core\Controllers\RestController; use Ronu\RestGenericClass\Core\Services\BaseService; class UsersController extends RestController { protected $modelClass = User::class; public function __construct() { $this->service = new BaseService($this->modelClass); } }
Filtering Guide
Basic filtering with oper
{
"oper": [
"rating|<|1",
"zip_code|=|0"
]
}
Logical groups with and / or
{
"oper": {
"and": [
"status|=|active",
"created_at|>=|2024-01-01"
],
"or": [
"type|=|premium",
"type|=|trial"
]
}
}
Relation-scoped filtering
{
"relations": ["users"],
"oper": {
"and": [
"status|=|active"
],
"users": {
"and": [
"name|like|%john%"
]
}
}
}
Nested relation example
{
"relations": ["users.roles"],
"oper": {
"users.roles": {
"and": [
"name|=|admin"
]
}
}
}
Dependencies
This package relies on Laravel components and optional packages for Excel/PDF/modules/permissions. Ensure your application includes:
illuminate/*components (database, support, validation, http, pagination, mail)- Optional:
maatwebsite/excel,barryvdh/laravel-dompdf,nwidart/laravel-modules,spatie/laravel-permission
Logging
The package registers a rest-generic-class logging channel (if not already configured)
that writes to storage/logs/rest-generic-class.log. To customize it, publish the package config:
php artisan vendor:publish --tag=rest-generic-class-config
Edit the published config at config/rest-generic-class.php to adjust channel driver,
path, or level. You can also override the channel directly in config/logging.php.
License
This library is open-sourced software licensed under the MIT license.
##Authors
- Charlietyn