PHP code example of ozziest / patika

1. Go to this page and download the library: Download ozziest/patika 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/ */

    

ozziest / patika example snippets

 
// Including composer autoload file
-catch block for handling routing errors
try {
    // You must create a new instance of Manager Class with the app argument.
    $patika = new Ozziest\Patika\Manager(['app' => 'App\Controllers']);
    // And calling the route!
    $patika->call();
} catch (Ozziest\Patika\Exceptions\PatikaException $e) {
    // If the controller or method aren't found, you can handle the error.
    echo $e->getMessage();
}

namespace App\Controllers;

class Users {

    /**
     * All
     *
     * @return null
     */
    public function all()
    {
        echo 'App\Controllers\Users@all()';
    }
    
}

$ php -S localhost:8000 index.php
$ curl -X GET localhost:8000/users/all