PHP code example of baghunts / laravel-fast-endpoints

1. Go to this page and download the library: Download baghunts/laravel-fast-endpoints library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

baghunts / laravel-fast-endpoints example snippets


  
  
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!';  
    }  
}

use App\Http\Endpoints\HelloWorld\HelloWorldEndpoint;

Route::get('/hello-world', HelloWorldEndpoint::class)