PHP code example of code2flourish / senregions

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

    

code2flourish / senregions example snippets


use Code2Flourish\SenRegions\RegionFactory;
use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper;

$fileSystem = new FileGetContentsWrapper();
$factory = new RegionFactory($fileSystem);

$regions = $factory->getAll();

use Code2Flourish\SenRegions\RegionFactory;
use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper;

$fileSystem = new FileGetContentsWrapper();
$factory = new RegionFactory($fileSystem);

$region = $factory->getRandomRegion();

use Code2Flourish\SenRegions\DepartmentFactory;
use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper;

$fileSystem = new FileGetContentsWrapper();
$factory = new DepartmentFactory($fileSystem);

$departments = $factory->getAll();

use Code2Flourish\SenRegions\DepartmentFactory;
use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper;

$fileSystem = new FileGetContentsWrapper();
$factory = new DepartmentFactory($fileSystem);

$departments = $factory->getAllByRegion(1);

use Code2Flourish\SenRegions\DepartmentFactory;
use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper;

$fileSystem = new FileGetContentsWrapper();
$factory = new DepartmentFactory($fileSystem);

$department = $factory->getRandomDepartment();