1. Go to this page and download the library: Download hkt/psr7-asset 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/ */
hkt / psr7-asset example snippets
$locator = new Hkt\Psr7Asset\AssetLocator();
$service = new Hkt\Psr7Asset\AssetService($locator);
$responder = new Hkt\Psr7Asset\AssetResponder(new Http\Factory\Diactoros\ResponseFactory());
$router = new Hkt\Psr7Asset\Router();
$assetAction = new Hkt\Psr7Asset\AssetAction($service, $responder, $router);
// ... more code
$assetAction->process($request, $requestHandler)
$locator->set('vendor/package', '/full/path/to/vendor/package');
$locator->set('vendor/package/css/style.css', '/full/path/to/vendor/package/public/css/style.css');
// override vendor/package style sheet, same applies for js and images
$locator->set('vendor/package/css/style.css', '/full/path/to/application/specific/public/css/style.css');
namespace Vendor\Package;
use Aura\Di\Container;
use Aura\Di\ContainerConfigInterface;
class AppConfig implements ContainerConfigInterface
{
public function define(Container $di)
{
// add one of the http-interop/http-factory library
$di->set('Interop\Http\Factory\ResponseFactoryInterface', $di->lazyNew('Http\Factory\Diactoros\ResponseFactory'));
}
public function modify(Container $di)
{
// Map more paths and location as above.
$assetLocator = $di->get('Hkt\Psr7Asset\AssetLocator');
// path to exact location
$assetLocator->set('vendor/package/css/hello.css', '/path/to/web/css/test.css');
// path to folder
$assetLocator->set('vendor/package', dirname(dirname(__DIR__)) . '/public');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.