1. Go to this page and download the library: Download phpsoftbox/api 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/ */
phpsoftbox / api example snippets
enum CatalogApiVersionEnum: string implements ApiVersionEnumInterface
{
case VERSION_1_0_0 = '1.0.0';
case VERSION_1_1_0 = '1.1.0';
public function version(): string
{
return $this->value;
}
}
$policy = new EnumApiVersionPolicy(
supportedVersions: CatalogApiVersionEnum::cases(),
defaultVersion: CatalogApiVersionEnum::VERSION_1_1_0,
);
$middleware = new ApiVersionMiddleware(
resolver: new HeaderApiVersionResolver('X-CATALOG-API-VERSION'),
factory: new DefaultApiRequestVersionFactory($policy),
headers: new ApiVersionResponseHeaders(
selected: 'X-CATALOG-API-VERSION',
minimum: 'X-CATALOG-API-VERSION-MIN',
latest: 'X-CATALOG-API-VERSION-LATEST',
),
);