PHP code example of not-empty / ala-microframework-php
1. Go to this page and download the library: Download not-empty/ala-microframework-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/ */
not-empty / ala-microframework-php example snippets
return [
'data' => [
'32c5a206ee876f4c6e1c483457561dbed02a531a89b380c3298bb131a844ac3c' => [ // default token
'name' => 'app-test', // default context
'secret' => 'a1c5930d778e632c6684945ca15bcf3c752d17502d4cfbd1184024be6de14540', // default secret
],
],
];
use App\Constants\PatternsConstants;
/**
* get rules for this request
* @return array
*/
public function getRules() : array
{
return [
'class' => 'string|in:"asc","desc"',
'fields' => 'string',
'order' => 'string',
'page' => 'integer|min:1',
'filter_name' => [
'string',
'regex:'.PatternsConstants::FILTER,
],
// here your new filter
'filter_age' => [
'string',
'regex:'.PatternsConstants::FILTER,
],
];
}
/**
* set filter rules for this domain
*/
public $filter = [
'age' => [
'validate' => 'integer|min:18|max:99',
'permissions' => [
FiltersTypesConstants::FILTER_EQUAL,
FiltersTypesConstants::FILTER_NOT_EQUAL,
],
],
'created' => [
'validate' => 'date',
'permissions' => [
FiltersTypesConstants::FILTER_LESS_THAN,
FiltersTypesConstants::FILTER_GREATER_THAN,
FiltersTypesConstants::FILTER_GREATER_THAN_OR_EQUAL,
FiltersTypesConstants::FILTER_LESS_THAN_OR_EQUAL,
],
],
'modified' => [
'validate' => 'date',
'permissions' => [
FiltersTypesConstants::FILTER_LESS_THAN,
FiltersTypesConstants::FILTER_GREATER_THAN,
FiltersTypesConstants::FILTER_GREATER_THAN_OR_EQUAL,
FiltersTypesConstants::FILTER_LESS_THAN_OR_EQUAL,
],
],
];
sh
docker exec -it ala-php bash
sh
php artisan create:domain {your_domain}
sh
php artisan migration
sh
php artisan random:create {domain_name}
sh
php artisan random:seed {domain_name} {number_of_records}