PHP code example of ochorocho / frankenphp

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

    

ochorocho / frankenphp example snippets



// EXT:my_ext/Configuration/FrankenPhpWorker.php — every key optional, pure data
return [
    'pin'             => [\Vendor\MyExt\Registry\FormatRegistry::class],     // kept with its dependency closure
    'keep'            => [\Vendor\MyExt\Service\PriceCalculator::class],     // kept while its closure stays clean
    'discard'         => [\Vendor\MyExt\Service\RequestScopedCollector::class, 'my_ext.legacy.service.id'],
    'discardPatterns' => ['/^Vendor\\\\MyExt\\\\Controller\\\\/'],           // matched against id and class
];
bash
VERSION=85 # 82-85 available
sudo curl https://pkg.henderkes.com/api/packages/${VERSION}/debian/repository.key -o /etc/apt/keyrings/static-php${VERSION}.asc
echo "deb [signed-by=/etc/apt/keyrings/static-php${VERSION}.asc] https://pkg.henderkes.com/api/packages/${VERSION}/debian php-zts main" | sudo tee -a /etc/apt/sources.list.d/static-php${VERSION}.list
sudo apt update
sudo apt install frankenphp

# Required for TYPO3 (sqlite sandbox):
sudo apt install php-zts-intl php-zts-gd php-zts-zip php-zts-sqlite3 php-zts-pdo-sqlite

# Optional, depending on how you run the sandbox:
sudo apt install php-zts-mysqli php-zts-pdo-mysql   # TYPO3_DB_DRIVER=mysqli
sudo apt install php-zts-apcu                       # TYPO3_CACHE_BACKEND=apcu
sudo apt install php-zts-imagick                    # instead of the `magick` CLI
bash
frankenphp php-cli -r 'var_dump(class_exists("Collator"));'          # expect bool(true)
frankenphp php-cli -r 'print_r(get_loaded_extensions());'            # full list
bash
vendor/bin/phpstan analyse --memory-limit=1G
vendor/bin/php-cs-fixer fix --config=php-cs-fixer.php
vendor/bin/phpunit