baghunts/laravel-fast-endpoints
最新稳定版本:v1.0.1
Composer 安装命令:
composer require baghunts/laravel-fast-endpoints
包简介
Laravel routes new (fast) experience
README 文档
README
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.
Installation
You can install the package via composer:
composer require baghunts/laravel-fast-endpoints
Quick Example
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. For more details and advanced usage, explore the rest of the documentation.
This quick example will give users a hands-on feel for how LFE simplifies the process of creating API endpoints, making the benefits immediately clear.
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-16