PHP code example of nusje2000 / strict-php

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

    

nusje2000 / strict-php example snippets


use Nusje2000\StrictPhp\File;

File::exists('path/to/file.txt');

use Nusje2000\StrictPhp\File;

File::getContents('path/to/file.txt');

use Nusje2000\StrictPhp\File;

File::putContents('path/to/file.txt', 'contents');

use Nusje2000\StrictPhp\Directory;

Directory::exists('path/to/file.txt');

use Nusje2000\StrictPhp\Json;

Json::encode(['key' => 'value']);

use Nusje2000\StrictPhp\Json;

Json::decode('"some-valid-json"');

use Nusje2000\StrictPhp\Json;

Json::decodeToObject('{"key": "value"}'); // stdClass { $key = 'value' }

use Nusje2000\StrictPhp\Json;

Json::decodeToArray('["value 1", "value 2", "value 3"]'); // ['value 1', 'value 2', 'value 3']
Json::decodeToArray('{"key": "value"}'); // ['key' => 'value']
shell script
composer