1. Go to this page and download the library: Download fansipan/request-matcher 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/ */
fansipan / request-matcher example snippets
use Fansipan\RequestMatcher\HostRequestMatcher;
use Psr\Http\Message\RequestInterface;
$matcher = new HostRequestMatcher('localhost');
// Matches http://localhost
/** @var RequestInterface $request */
$matcher->matches($request);
use Fansipan\RequestMatcher\CallbackRequestMatcher;
use Psr\Http\Message\RequestInterface;
$matcher = new CallbackRequestMatcher(static fn (RequestInterface $request) => $request->getUri()->getScheme() === 'https' && $request->getUri()->getHost() === 'my.app');
use Fansipan\RequestMatcher\CallbackRequestMatcher;
use Fansipan\RequestMatcher\HostRequestMatcher;
use Fansipan\RequestMatcher\SchemeRequestMatcher;
use Psr\Http\Message\RequestInterface;
$matcher = new ChainRequestMatcher([
new SchemeRequestMatcher('https'),
new HostRequestMatcher('my.app'),
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.