PHP code example of janatzend / zend-expressive-legacy-bridge

1. Go to this page and download the library: Download janatzend/zend-expressive-legacy-bridge 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/ */

    

janatzend / zend-expressive-legacy-bridge example snippets

legacybridge.global.php


use Zend\Expressive\LegacyBridge\ConfigProvider;

return (new ConfigProvider())();
index.php
zf1-prereq.global.php

'zf1-prereq' => function() {
    defined('APPLICATION_ENV')
        || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
    // ...
    set_
index.php
index.php
zf.php
/zf.php/tracking/list
config/autoload/redirectory.global.php


return [
    'dependencies' => [
        'services' => [
            'pathCreator' => function ($req) {
                $url  = $req->getUri();

                return '/zf.php' . $url->getPath();
            }
        ]
    ]
]
index.php
ConfigProvider.php
config/autoload/hydrator.global.php

'factories' => [
    'HydratorStrategyTrackingList' => function() {
        return new StrategyChain([
            new ClosureStrategy(function ($data) {
                if (!is_a($data, 'ArrayAccess')) return $data;

                return $data->toArray();
            }),

            new ClosureStrategy(function ($data) {
                /* HACK for specific situation, Rowset conatins binary data */
                foreach ($data as $rowNr => $row) {
                    foreach ($row as $key => $value) {
                        if (preg_match('~[^\x20-\x7E\t\r\n]~', $value) > 0) unset($data[$rowNr][$key]);
                    }
                }

                return $data;
            })
        ]);
    }
],
config/autoload/sf1-prereq.global.php

'sf1-prereq' => function() {
    
web/expressive.php
web/index.php
web/expressive.php

RewriteRule ^rest/(.*)$ expressive.php [L,NC]
web/expressive.php
ConfigProvider.php
/en/
config/autoload/route-mapping.global.php
/en/
config/autoload/hydrator.global.php