Get Started | Installation | Configuration | Endpoints | Attributes | Commands |
LFE (Laravel Fast Endpoints) is a developer-friendly and efficient alternative to traditional MVC for providing API services to clients. It introduces a new, fast approach using PHP Attributes and a File-Driven architecture. With LFE, there’s no need to manually define routes—they are automatically registered, streamlining the development process.
You can install the package via composer:
composer require baghunts/laravel-fast-endpoints
Let’s walk through a simple example to demonstrate how easy it is to create an API endpoint with LFE.
<?php
namespace App\Http\Endpoints\HelloWorld;
use Baghunts\LaravelFastEndpoints\Attributes\Get;
use Baghunts\LaravelFastEndpoints\Endpoint\Endpoint;
#[Get('/hello-world')]
class HelloWorldEndpoint extends Endpoint
{
/**
* Handle the incoming request for the endpoint with path '/hello-world'
*
* @return string
*/
public function __invoke(): string
{
return 'Hello World!';
}
}
LFE automatically registers the route for this endpoint.
use App\Http\Endpoints\HelloWorld\HelloWorldEndpoint;
Route::get('/hello-world', HelloWorldEndpoint::class)
That’s it! You’ve just created and accessed an API endpoint using LFE with minimal setup.
Prev - Repository | Next - installation |