PHP code example of fatalus / feather

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

    

fatalus / feather example snippets




eather\Kernel;

define('FEATHER_ROOT', realpath(rtrim(__DIR__ . '/..', DIRECTORY_SEPARATOR)));

$kernel = new Kernel();

echo $kernel->handle();



$engine = new Feather\Engine();
$auth = new MyApp\Controller\AuthController();
$post = new MyApp\Controller\PostController();

return [
  'GET' => [
    '/' => fn() => $engine->render('home'),
    '/hello' => fn() => 'Hello, world!',
    '/posts/{post_id}' => fn($params) => $post->show($params),
  ],
  'POST' => [
    '/login' => fn() => $auth->login(),
  ],
];


$engine = new Feather\Engine();

return [
  'GET' => [
    '/' => fn() => $engine->render('home'),
    '/' => fn() => $engine->render('admin/posts/edit'),
  ]
];

 $this->extend('layouts/app'); 

<body class="bg-gray-950 text-white container mx-auto">
    <header class="mb-8">
        <?= $this->



use Feather\Cache;

$my_data = [
  'test' => true,
  'dataset' [
    'new' => true,
    'creation_time' => time(),
    'data' => [
      1, 2, 3, 4
    ]
  ]
];

Cache::cacheData('my_data', json_encode($my_data));

$my_cached_data = Cache::get('my_data');



$kernel = new Kernel(new MyApp/Router(), new MyApp/Request());
bash
cp -r ./vendor/fatalus/feather/skeleton/* ./
text
my-app/
├── public/
│   └── index.php
├── templates/
│   └── home.phtml
├── routes.php
├── development.php
├── vendor/
├── src/
└── composer.json