The skeleton application for the Laro-zero API framework.
hamza-wakrim/laro-zero is a Laravel package for the skeleton application for the laro-zero api framework..
It currently has 2 GitHub stars and 18 downloads on Packagist (latest version v1.0).
Install it with composer require hamza-wakrim/laro-zero.
Discover more Laravel packages by hamza-wakrim
or browse all Laravel packages to compare alternatives.
Last updated
A lightweight, API-only Laravel framework fork optimized for building RESTful APIs and microservices.
Laro-Zero is a streamlined version of Laravel, specifically designed for API development. Built on top of the hamza-wakrim/api-framework, it removes all frontend dependencies and view-related components, making it perfect for:
Laro-Zero enforces a strict layered architecture pattern that all developers must follow:
Route → Controller → Service → Model
Routes (routes/api.php)
Controllers (app/Http/Controllers/)
App\Http\Controllers\ControllerServices (app/Services/)
App\Services\ServiceApp\Services namespace and end with ServiceModels (app/Models/)
App\Services\ServicevalidateService() method to ensure proper service injection// routes/api.php
Route::get('/examples', [ExamplesController::class, 'index']);
// app/Http/Controllers/ExamplesController.php
class ExamplesController extends Controller
{
public function __construct(
private ExampleService $exampleService
) {
$this->validateService($exampleService);
}
public function index(): JsonResponse
{
$users = $this->exampleService->getAllUsers();
return response()->json($users);
}
}
// app/Services/ExampleService.php
class ExampleService extends Service
{
public function getAllUsers()
{
return Examples::all(); // Interacts with Model
}
}
// app/Models/Examples.php
class Examples extends Model
{
// Model definition only
}
When adding new features, follow these steps:
Create the Model (if needed)
php artisan make:model Product
Create the Service
php artisan make:service ProductService
Then extend App\Services\Service and add business logic methods.
Create the Controller
php artisan make:controller ProductController
Then inject the service in the constructor and call service methods.
Add Routes
Route::prefix('products')->group(function () {
Route::get('/', [ProductController::class, 'index']);
// ... more routes
});
composer create-project hamza-wakrim/laro-zero your-project-name
git clone https://github.com/hamza-wakrim/laro-zero.git
cd laro-zero
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate
php artisan serve
Access the API:
http://localhost:8000/api/healthhttp://localhost:8000/api/*Development mode (with queue and logs):
composer run dev
laro-zero/
├── app/ # Application code
│ ├── Http/
│ │ └── Controllers/ # API Controllers (call Services only)
│ ├── Services/ # Business logic layer (call Models)
│ ├── Models/ # Eloquent Models (database entities)
│ └── Providers/ # Service Providers
├── routes/
│ ├── api.php # API routes (call Controllers only)
│ └── console.php # Artisan commands
├── config/ # Configuration files
├── database/ # Migrations, factories, seeders
└── tests/ # PHPUnit tests
Important: The directory structure enforces the design pattern:
routes/api.php → calls app/Http/Controllers/app/Http/Controllers/ → calls app/Services/app/Services/ → calls app/Models/All API routes are defined in routes/api.php. By default, routes are prefixed with /api.
Remember: Routes MUST only call Controllers, never Services or Models directly.
Example:
// ✅ CORRECT: Route calls Controller
Route::get('/users', [UserController::class, 'index']);
// ❌ WRONG: Route calls Service directly
Route::get('/users', function () {
return UserService::getAllUsers(); // DON'T DO THIS
});
// ❌ WRONG: Route calls Model directly
Route::get('/users', function () {
return User::all(); // DON'T DO THIS
});
composer setup - Install dependencies and set up the projectcomposer dev - Start development server with queue and logscomposer test - Run PHPUnit testsphp artisan serve - Start the development serverphp artisan migrate - Run database migrationsKey configuration files:
config/app.php - Application configurationconfig/database.php - Database settingsconfig/auth.php - Authentication settingsRun tests with:
composer test
Or directly with PHPUnit:
php artisan test
This project uses hamza-wakrim/api-framework as its core framework, which is a Laravel fork optimized for API development.
Contributions are welcome! Please feel free to submit a Pull Request.
The Laro-Zero framework is open-sourced software licensed under the MIT license.
For issues and questions, please open an issue on the GitHub repository.