1. Go to this page and download the library: Download boneframework/skeleton 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/ */
boneframework / skeleton example snippets
namespace Bone\App;
use Bone\App\Controller\IndexController;
use Bone\Controller\Init;
use Bone\Router\Router;
use Bone\Router\RouterConfigInterface;
use Barnacle\RegistrationInterface;
use Barnacle\Container;
class AppPackage implements RegistrationInterface, RouterConfigInterface
{
/**
* @param Container $c
*/
public function addToContainer(Container $c)
{
$c[IndexController::class] = $c->factory(function (Container $c) {
$controller = new IndexController();
return Init::controller($controller, $c);
});
}
/**
* @param Container $c
* @param Router $router
* @return Router
*/
public function addRoutes(Container $c, Router $router): Router
{
$router->map('GET', '/', [IndexController::class, 'indexAction']);
$router->map('GET', '/learn', [IndexController::class, 'learnAction']);
return $router;
}
}
// from a controller:
$this->getTranslator()->translate('placeholder.string');
// to set locale
$this->getTranslator()->setLocale($locale);
// from a view file:
$this->t('placeholder');