1. Go to this page and download the library: Download madewithlove/glue 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/ */
madewithlove / glue example snippets
// Create container
$container = new Container();
$container->addServiceProvider(SomeProvider::class);
$container->addServiceProvider(AnotherProvider::class);
// Create router and routes
$router = new RouteCollection($container);
$router->get('/', 'SomeController::index');
// Create PSR7 middleware handler
$relay = (new RelayBuilder())->newInstance([
SomeMiddleware::class,
function($request, $response, $next) use ($router) {
$next($request, $router->dispatch($request, $response));
},
]);
// Create PSR7 stack
$request = ServerRequestFactory::fromGlobals();
$response = $relay(new Request, new Response());
(new SapiEmitter())->emit($response);
$app = (new Glue())
->setServiceProviders([
new SomeServiceProvider(),
new AnotherServiceProvider(),
new LeagueRouteServiceProvider(),
])
->setMiddlewares([
SomeMiddleware::class,
LeagueRouteMiddleware::class,
]);
// Decorates a router of your choice
$app->get('/', 'SomeController::index');
$app->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.