Use this package if you want to have all the regions and departments in Senegal
Require the package using composer
composer require code2flourish/senregionsuse 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);✍🏾: The number passed in parameter represents the id of the region that you can find in the list of regions
use Code2Flourish\SenRegions\DepartmentFactory;
use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper;
$fileSystem = new FileGetContentsWrapper();
$factory = new DepartmentFactory($fileSystem);
$department = $factory->getRandomDepartment();Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.