PHP code example of phpcompatibility / php-compatibility

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

    

phpcompatibility / php-compatibility example snippets

json
    ""phpcompatibility/php-compatibility": "*"
    },
    "prefer-stable" : true
    
json
        "scripts": {
            "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
            "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
        }
        
xml
        <config name="installed_paths" value="vendor/phpcompatibility/php-compatibility" />
        
xml
    <!-- Whitelist the mysql_to_rfc3339() and mysql_another_function() functions. -->
    <rule ref="PHPCompatibility.Extensions.RemovedExtensions">
        <properties>
            <property name="functionWhitelist" 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>