1. Go to this page and download the library: Download fol/core 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/ */
fol / core example snippets
$app = new Fol();
//Definir dependencias:
$app->set('database', function () {
return new MyDatabaseClass($config);
});
//Engadir outros conenedores compatibles con Container-Interop
$app->add($container);
//Engadir un ServiceProviderInterface
$app->register(new MyServiceProvider());
//Obter as dependencias
$database = $app->get('database');
//Tamén podes usar a interface de array para engadir/obter dependencias:
$database = $app['database'];
$app['templates'] = function () {
return new TemplatesEngine();
};
$app = new Fol();
//Dame a ruta
$app->getPath(); // /var/www/sitioweb/app
//Dame a ruta xuntándolle estas pezas:
$app->getPath('dir/subdir', '../outro'); // /var/www/sitioweb/dir/outro
//O path calculase automaticamente (o directorio onde se atopa a clase instanciada) pero podes cambialo:
$path->setPath(__DIR__); //Nunca pode rematar en "/"
$app = new Fol();
//Define unha url
$app->setUrl('http://localhost/o-meu-sitio');
//Dame a url
$app->getUrl(); // http://localhost/o-meu-sitio
//Dame só o path
$app->getUrlPath(); // /o-meu-sitio
//Dame só o host
$app->getUrlHost(); // http://localhost
//Tamén podes engadirlle pezas:
$app->getUrl('post/1', 'ver'); // http://localhost/o-meu-sitio/post/1/ver
$app->getUrlPath('post/1', 'ver'); // /o-meu-sitio/post/1/ver
namespace App;
use Fol;
class App extends Fol {
}
$app = new App();
//Dame o namespace
$app->getNamespace(); // App
//Tamén podes engadirlle pezas
$app->getNamespace('Controllers\\Base'); // App\\Controllers\\Base;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.