PHP code example of benycode / slim-request-accept-header

1. Go to this page and download the library: Download benycode/slim-request-accept-header 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/ */

    

benycode / slim-request-accept-header example snippets


use Psr\Container\ContainerInterface;
use BenyCode\Slim\RequestAcceptHeader\LanguageDetectMiddleware;

return [
    ......
  LanguageDetectMiddleware::class => function (ContainerInterface $container): LanguageDetectMiddleware {
		
      return new LanguageDetectMiddleware(
        'lt', 
        ['lt', 'en'],
      );
  },
];

use BenyCode\Slim\RequestAcceptHeader\LanguageDetectMiddleware;

$app
  ...
  ->add(LanguageDetectMiddleware::class)
  ;
  ...