PHP code example of waglpz / webapp-restapi

1. Go to this page and download the library: Download waglpz/webapp-restapi 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/ */

    

waglpz / webapp-restapi example snippets





declare(strict_types=1);

/**
* when testing wepapp then create /public Directory as DocumentRoot and insert index.php
*/

use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\Dotenv\Dotenv;
use Waglpz\Webapp\App;

use function Waglpz\Webapp\container;

tainer->get(App::class);
$request   = $container->get(ServerRequestInterface::class);
\assert($app instanceof App && $request instanceof ServerRequestInterface);
$app->run($request);

  
bash

docker run \
--user $(id -u):$(id -g) \
--rm \
-ti \
-v $PWD:/app \
-v $PWD/.docker/ \
-v $PWD/.docker/php/php-ini-overrides.ini:/usr/local/etc/php/conf.d/99-overrides.ini \
waglpz/webapp bash 

bash

docker run \
--rm \
-ti \
-v $PWD:/app \
-v $PWD/.docker/ \
-v $PWD/.docker/php/php-ini-overrides.ini:/usr/local/etc/php/conf.d/99-overrides.ini \
waglpz/webapp bash