1. Go to this page and download the library: Download markstory/cakephp-spekkoek 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/ */
markstory / cakephp-spekkoek example snippets
public function __invoke($request, $response, $next)
use Cake\Log\Log;
class TimingMiddleware
{
public function __invoke($request, $response, $next)
{
$start = microtime(true);
$response = $next($request, $response);
$end = microtime(true);
Log::info(sprintf(
'Request to %s took %f seconds',
$request->getUri()->getPath(),
($end - $start)
));
return $response;
}
}
namespace App;
use Spekkoek\BaseApplication;
use Spekkoek\Middleware\AssetMiddleware;
use Spekkoek\Middleware\ErrorHandlerMiddleware;
use Spekkoek\Middleware\RoutingMiddleware;
class Application extends BaseApplication
{
public function middleware($middleware)
{
// Catch any exceptions in the lower layers,
// and make an error page/response
$middleware->push(new ErrorHandlerMiddleware());
// Handle plugin/theme assets like CakePHP normally does.
$middleware->push(new AssetMiddleware());
// Apply routing
$middleware->push(new RoutingMiddleware());
// The application is bound into the middleware
// stack by the Server
return $middleware;
}
}
use Spekkoek\Server;
use App\Application;
// Bind your application to the server.
$server = new Server(new Application(dirname(__DIR__) . '/config'));
// Run the request/response through the application
// and emit the response.
$server->emit($server->run());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.