PHP code example of ptuchik / core-utilities

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

    

ptuchik / core-utilities example snippets


class Gender extends AbstractTypes {
    const MALE = 1;
    const FEMALE = 2;
}

    print_r(Gender::MALE); // Output: 1
    print_r(Gender::FEMALE); // Output: 2
    print_r(Gender::all()); // Output: '1,2'
    print_r(Gender::all('json')); // Output: '{"1":"translated.male","2":"translated.female"}'
    // You can also pass second parameter false, to not translate the values
    print_r(Gender::all('json', false)); // Output: '{"1":"MALE","2":"FEMALE"}'
    print_r(Gender::all('array')); // Output: ["MALE" => 1, "FEMALE" => 2]

use Ptuchik\CoreUtilities\Helpers\Storage;

$storage = new Storage(); // Pass true as the only parameter if you need to initialize your public storage

// ... after initialization you can use $storage variable as regular Filesystem Adapter. like:

$storage->get($path);
$storage->put($path);

// ...etc...