PHP code example of magento / php-compatibility-fork

1. Go to this page and download the library: Download magento/php-compatibility-fork 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/ */

    

magento / php-compatibility-fork example snippets

json
    ""magento/php-compatibility-fork": "*"
    },
    "prefer-stable" : true
    
json
        "scripts": {
            "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/magento/php-compatibility-fork",
            "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/magento/php-compatibility-fork"
        }
        
xml
        <config name="installed_paths" value="vendor/magento/php-compatibility-fork" />
        
xml
    <!-- Allow the mysql_to_rfc3339() and mysql_another_function() functions. -->
    <rule ref="PHPCompatibility.Extensions.RemovedExtensions">
        <properties>
            <property name="functionAllowlist" type="array" value="mysql_to_rfc3339,mysql_another_function"/>
        </properties>
    </rule>
xml
    <rule ref="PHPCompatibility.Interfaces.RemovedSerializable">
        <properties>
            <property name="serializableInterfaces" type="array">
                <element value="MyCustomSerializableInterface"/>
                <element value="AnotherSerializableInterface"/>
            </property>
        </properties>
    </rule>