1. Go to this page and download the library: Download fizk/library 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/ */
fizk / library example snippets
chdir(dirname(__DIR__));
include __DIR__ . '/../vendor/autoload.php';
use Laminas\Diactoros\Response\EmptyResponse;
use Laminas\Diactoros\ServerRequestFactory;
use Laminas\HttpHandlerRunner\Emitter\SapiEmitter;
use Library\Container\Container;
use Library\Http\Response\ServerErrorResponse;
use Library\Http\ServerFilter\ContentTypeFilter;
use Library\Router\Router;
set_error_handler(function ($severity, $message, $file, $line)
{
if (!(error_reporting() & $severity)) {
return;
}
throw new ErrorException($message, 0, $severity, $file, $line);
});
$emitter = new SapiEmitter();
try {
$request = ServerRequestFactory::fromGlobals(
$_SERVER,
$_GET,
$_POST,
$_COOKIE,
$_FILES,
new ContentTypeFilter(ContentTypeFilter::ARRAY),
);
$serviceManager = new Container(
chdir(dirname(__DIR__));
include __DIR__ . '/../vendor/autoload.php';
use Library\Container\Container;
use Library\Router\Router;
use function Library\run;
set_error_handler(function ($severity, $message, $file, $line)
{
if (!(error_reporting() & $severity)) {
return;
}
throw new \ErrorException($message, 0, $severity, $file, $line);
});
$serviceManager = new Container(