stijlgenoten / data-collection
Superlight static DataCollection package for Laravel
dev-master
2020-06-04 12:59 UTC
This package is auto-updated.
Last update: 2025-06-05 00:36:25 UTC
README
This package ensures that, for example, static data such as a country list are available everywhere in your laravel application with useful functions, see it as an static data resource without using any DB.
Install
composer require stijlgenoten/data-collection
Use
Run this command to make a data collection
php artisan make:datacollection {Name}
The package will automatically generate a file ( in folder App\DataCollections
) looking like this:
<?php namespace App\DataCollections; use Stijlgenoten\DataCollection\DataCollection; class DummyCollection extends DataCollection { public static function RegisterData() { return []; } }
Within the RegisterData()
function you can for store an array, some examples:
return ['red','white','blue'];
return [ 'NL' => 'Nederland', 'XX' => 'Xxxxxx', ];