PHP code example of jahwin / wecodefy

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

    

jahwin / wecodefy example snippets


$routes = [
    [
        'path' => '/',
        'method' => 'GET',
        'folder' => 'site',
        'return' => 'HomeController@index',
    ],
    [
        'path' => '/api',
        "children" => [
            [
                'path' => '/',
                'method' => 'GET',
                'folder' => 'api',
                'return' => 'HomeController@index',
            ],
        ],

    ],
]

#You can use name as arguments in function.
$routes = [
    [
        'path' => '/info/{name}',
        'method' => 'GET',
        'folder' => 'site',
        'return' => function ($name) {
            echo 'Hello ' . $name;
        },
    ]
]

$routes = [
    [
        'path' => '/api',
        "children" => [
            [
                'path' => '/',
                'method' => 'GET',
                'folder' => 'api',
                'return' => 'HomeController@index',
            ],
        ],

    ],
]
 

/* -----------------------------
 * This is condition array, please don't change any key just add values
 * This will be user if you want to redirect all route to the same controller function
 * -----
 * This condition will be good for Vue,Angular,React
 * -----
 * Let that framework to handle routes
 * ----
 * You can enable or disable this condition
 * ------------------------------
 */
$route_condition = [
    'ENABLED' => true,
    'ALL_TO' => [
        'folder' => 'site',
        'return' => 'HomeController@index',
    ],
    'EXCEPT' => ['/api','/admin'],
];

 $routes = [
    [
        'path' => '*',
        'folder' => 'site',
        'return' => 'PagesController@index',
    ]
 ];
 

if(isContain(url(),'/api')){
    $array_obj = new \stdClass();
    $array_obj->status = "fail";
    $array_obj->message = 'Your request not found';
    return responce(json_encode($array_obj),404);
}

$routes = [
    [
        'path' => '/',
        'method' => 'GET',
        'folder' => 'site',
        'middleware' => 'web',
        'return' => 'HomeController@index',
    ]
]


$middleware = [
    "web" => app\middlewares\AuthMiddleware::class, 
]



namespace app\middlewares;

use Pecee\Http\Middleware\IMiddleware;
use Pecee\Http\Request;

class AuthMiddleware implements IMiddleware
{

    public function handle(Request $request): void
    {
        $user = "";
        // If authentication failed, redirect request to 404 page.
        if ( $user === null) {
            responce("",404);
        }

    }

}
  


namespace app\controllers\[foldername];

use system\library\Controller;


class Home extends Controller
{
    public function __construct()
    {
        parent::__construct();
    }

    public function welcome()
    {
        $data = array("name"=>"Hello world");
        // Load template from `app/scheme/views/[folder_name]/home/index.twig`
        return $this->render('folder name', 'home/index.twig', $data);
    }

}


use system\library\Lang;
/* -----------------------------
| Twig filter management
-------------------------------- */
$filters = [
    [
        'name' => 'env',
        'func' => function ($val) {
            return getenv($val);
        },
    ], [
        'name' => 'translate',
        'func' => function ($val) {
            return Lang::init()->Trans($val);
        },
    ],

];

/* -----------------------------
| Twig functions management
-------------------------------- */
$functions = [
    [
        'name' => 'requestIs',
        'func' => function ($url, $feedback) {
            $url = strtolower($url);
            if (url() == $url) {
                return $feedback;
            }
        },
    ],
    [
        'name' => 'requestContain',
        'func' => function ($url, $feedback) {
            $url = strtolower($url);
            if (url()->contains($url)) {
                return $feedback;
            }
        },
    ],
    [
        'name' => 'cutText',
        'func' => function ($string, $length, $icon) {
            return cutText($string, $length, $icon);
        },
    ]
];


namespace app\models; 

use system\library\Models;
use system\library\DB;

class User extends Models {
    // This will allow to get all users in users table
    public function getAllUser() {
        $data = DB::table( 'users' )
        ->orderBy( 'id', 'desc' )->get();
        return $data;
    }
}


use Illuminate\Database\Schema\Blueprint;
/**
* --------------------------------------------
* Setting up database
* -------------------------------------------
* Don't change this variable name
*/
$db_up_migration = [
    [
        "key" => 1,
        "table"=>"tb_client",
        "todo" =>"create",
        "run" => function( Blueprint $table ) {
            $table->string( "email" )->index();
            $table->string( "token" )->index();
            $table->timestamps();
        },
        "reason"=>"Creating tb_client table"
    ],
    [
        "key" => 2,
        "table"=>"tb_books",
        "todo" =>"create",
        "run" => function( Blueprint $table ) {
            $table->string( "name" )->index();
            $table->timestamps();
        },
        "reason"=>"Creating tb_books table"
    ],
    [
        "key" => 3,
        "table"=>"tb_books",
        "todo" =>"rename",
        "run" => "tb_book",
        "reason"=>"Reaname tb_books to tb_book table"
    ]

];

/**
* --------------------------------------------
* Rollback database
* -------------------------------------------
* Don't change this variable name
*/
$db_down_migration = [
    [
        "key" => 1,
        "table"=>"tb_client",
        "todo" =>"delete",
        "run" => "drop",
        "reason"=>"Removing tb_client table"
    ],
    [
        "key" => 2,
        "table"=>"tb_book",
        "todo" =>"delete",
        "run" => "drop",
        "reason"=>"Removing tb_book table"
    ]
];


$table->bigIncrements('id');	//Auto-incrementing UNSIGNED BIGINT (primary key) equivalent column.

$table->bigInteger('votes');	//BIGINT equivalent column.

$table->binary('data');	//BLOB equivalent column.

$table->boolean('confirmed');	//BOOLEAN equivalent column.

$table->char('name', 100);	//CHAR equivalent column with an optional length.

$table->date('created_at');	//DATE equivalent column.

$table->dateTime('created_at');	//DATETIME equivalent column.

$table->dateTimeTz('created_at');	//DATETIME (with timezone) equivalent column.

$table->decimal('amount', 8, 2);	//DECIMAL equivalent column with a precision (total digits) and scale (decimal digits).

$table->double('amount', 8, 2);	//DOUBLE equivalent column with a precision (total digits) and scale (decimal digits).

$table->enum('level', ['easy', 'hard']); ENUM equivalent column.

$table->float('amount', 8, 2);	//FLOAT equivalent column with a precision (total digits) and scale (decimal digits).

$table->geometry('positions');	//GEOMETRY equivalent column.

$table->geometryCollection('positions');	//GEOMETRYCOLLECTION equivalent column.

$table->increments('id');	//Auto-incrementing UNSIGNED INTEGER (primary key) equivalent column.

$table->integer('votes');	//INTEGER equivalent column.

$table->ipAddress('visitor');	//IP address equivalent column.

$table->json('options');	//JSON equivalent column.

$table->jsonb('options');	//JSONB equivalent column.

$table->lineString('positions');	//LINESTRING equivalent column.

$table->longText('description');	//LONGTEXT equivalent column.

$table->macAddress('device');	//MAC address equivalent column.

$table->mediumIncrements('id');	//Auto-incrementing UNSIGNED MEDIUMINT (primary key) equivalent column.

$table->mediumInteger('votes');	//MEDIUMINT equivalent column.

$table->mediumText('description');	//MEDIUMTEXT equivalent column.

$table->morphs('taggable');	//Adds taggable_id UNSIGNED BIGINT and taggable_type VARCHAR equivalent columns.

$table->uuidMorphs('taggable');	//Adds taggable_id CHAR(36) and taggable_type VARCHAR(255) UUID equivalent columns.

$table->multiLineString('positions');	//MULTILINESTRING equivalent column.

$table->multiPoint('positions');	//MULTIPOINT equivalent column.

$table->multiPolygon('positions');	//MULTIPOLYGON equivalent column.

$table->nullableMorphs('taggable');	//Adds nullable versions of morphs() columns.

$table->nullableUuidMorphs('taggable');	//Adds nullable versions of uuidMorphs() columns.

$table->nullableTimestamps();	//Alias of timestamps() method.

$table->point('position');	//POINT equivalent column.

$table->polygon('positions');	//POLYGON equivalent column.

$table->rememberToken();	//Adds a nullable remember_token VARCHAR(100) equivalent column.

$table->set('flavors', ['strawberry', 'vanilla']);	//SET equivalent column.

$table->smallIncrements('id');	//Auto-incrementing UNSIGNED SMALLINT (primary key) equivalent column.

$table->smallInteger('votes');	//SMALLINT equivalent column.

$table->softDeletes();	//Adds a nullable deleted_at TIMESTAMP equivalent column for soft deletes.

$table->softDeletesTz();	//Adds a nullable deleted_at TIMESTAMP (with timezone) equivalent column for soft deletes.

$table->string('name', 100);	//VARCHAR equivalent column with a optional length.

$table->text('description');	//TEXT equivalent column.

$table->time('sunrise');	//TIME equivalent column.

$table->timeTz('sunrise');	//TIME (with timezone) equivalent column.

$table->timestamp('added_on');	//TIMESTAMP equivalent column.

$table->timestampTz('added_on');	//TIMESTAMP (with timezone) equivalent column.

$table->timestamps();	//Adds nullable created_at and updated_at TIMESTAMP equivalent columns.

$table->timestampsTz();	//Adds nullable created_at and updated_at TIMESTAMP (with timezone) equivalent columns.

$table->tinyIncrements('id');	//Auto-incrementing UNSIGNED TINYINT (primary key) equivalent column.

$table->tinyInteger('votes');	//TINYINT equivalent column.

$table->unsignedBigInteger('votes');	//UNSIGNED BIGINT equivalent column.

$table->unsignedDecimal('amount', 8, 2);	//UNSIGNED DECIMAL equivalent column with a precision (total digits) and scale (decimal digits).

$table->unsignedInteger('votes');	//UNSIGNED INTEGER equivalent column.

$table->unsignedMediumInteger('votes');	//UNSIGNED MEDIUMINT equivalent column.

$table->unsignedSmallInteger('votes');	//UNSIGNED SMALLINT equivalent column.

$table->unsignedTinyInteger('votes');	//UNSIGNED TINYINT equivalent column.

$table->uuid('id');	//UUID equivalent column.

$table->year('birth_year');	//YEAR equivalent column.


$table->string('first_name')->nullable();

->after('column')	//Place the column "after" another column (MySQL)

->autoIncrement()	//Set INTEGER columns as auto-increment (primary key)

->charset('utf8')	//Specify a character set for the column (MySQL)

->collation('utf8_unicode_ci')	//Specify a collation for the column (MySQL/PostgreSQL/SQL Server)

->comment('my comment')	//Add a comment to a column (MySQL/PostgreSQL)

->default($value)	//Specify a "default" value for the column

->first()	//Place the column "first" in the table (MySQL)

->nullable($value = true)	//Allows (by default) NULL values to be inserted into the column

->storedAs($expression)	//Create a stored generated column (MySQL)

->unsigned()	//Set INTEGER columns as UNSIGNED (MySQL)

->useCurrent()	//Set TIMESTAMP columns to use CURRENT_TIMESTAMP as default value

->virtualAs($expression)	//Create a virtual generated column (MySQL)

$table->string('name', 50)->change(); // Change size of column

$table->string('name', 50)->nullable()->change(); // Change column to be nullable

$table->renameColumn('from', 'to'); // Rename column

$table->dropColumn('votes'); // Drop column

$table->dropColumn(['votes', 'avatar', 'location']); //Drop multiple columns from a table by passing an array of column names 

 $table->string('email')->unique(); // Create column with index

 $table->index(['student_id', 'start_at']); // Create index on multiple columns you have created

$table->primary('id');	// Adds a primary key.

$table->primary(['id', 'parent_id']);	// Adds composite keys.

$table->unique('email');	// Adds a unique index.

$table->index('state');	// Adds a plain index.


$table->dropPrimary('users_id_primary');	//Drop a primary key from the "users" table.

$table->dropUnique('users_email_unique');	//Drop a unique index from the "users" table.

$table->dropIndex('user_state_index');	//Drop a basic index from the "user" table.
 

$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');

$table->foreign('user_id')
      ->references('id')->on('users')
      ->onDelete('cascade');

$table->dropForeign('posts_user_id_foreign');


use Faker\Factory;
$generate = Factory::create();
/**
* --------------------------------------------
* Inserting fake data in database
* -------------------------------------------
* Don't change this variable name
*/
$database_seeder = [
    [
        'key' => 1,
        'table' => 'tb_user',
        'rows' => 10,
        'fields' => function () use ($generate) {
            return [
                'first_name' => $generate->name,
                'last_name' => $generate->name,
                'email' => $generate->email,
                'password' => $generate->password,
            ];
        },
    ],
];

    $generate->randomDigit;            // 7
    $generate->randomDigitNot(5);      // 0, 1, 2, 3, 4, 6, 7, 8, or 9
    $generate->randomDigitNotNull;      // 5
    $generate->randomNumber($nbDigits = NULL, $strict = false); // 79907610
    $generate->randomFloat($nbMaxDecimals = NULL, $min = 0, $max = NULL); // 48.8932
    $generate->numberBetween($min = 1000, $max = 9000); // 8567
    $generate->randomLetter;// 'b'
    // returns randomly ordered subsequence of a provided array
    $generate->randomElements($array = array ('a','b','c'), $count = 1); // array('c')
    $generate->randomElement($array = array ('a','b','c')); // 'b'
    $generate->shuffle('hello, world'); // 'rlo,h eoldlw'
    $generate->shuffle(array(1, 2, 3)); // array(2, 1, 3)
    $generate->numerify('Hello ###'); // 'Hello 609'
    $generate->lexify('Hello ???'); // 'Hello wgt'
    $generate->bothify('Hello ##??'); // 'Hello 42jz'
    $generate->asciify('Hello ***'); // 'Hello R6+'
    $generate->regexify('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'); // [email protected]

    $generate->word;                                             // 'aut'
    $generate->words($nb = 3, $asText = false);                  // array('porro', 'sed', 'magni')
    $generate->sentence($nbWords = 6, $variableNbWords = true);  // 'Sit vitae voluptas sint non voluptates.'
    $generate->sentences($nb = 3, $asText = false);              // array('Optio quos qui illo error.', 'Laborum vero a officia id corporis.', 'Saepe provident esse hic eligendi.')
    $generate->paragraph($nbSentences = 3, $variableNbSentences = true); // 'Ut ab voluptas sed a nam. Sint autem inventore aut officia aut aut blanditiis. Ducimus eos odit amet et est ut eum.'
    $generate->paragraphs($nb = 3, $asText = false);             // array('Quidem ut sunt et quidem est accusamus aut. Fuga est placeat rerum ut. Enim ex eveniet facere sunt.', 'Aut nam et eum architecto fugit repellendus illo. Qui ex esse veritatis.', 'Possimus omnis aut incidunt sunt. Asperiores incidunt iure sequi cum culpa rem. Rerum exercitationem est rem.')
    $generate->text($maxNbChars = 200);                          // 'Fuga totam reiciendis qui architecto fugiat nemo. Consequatur recusandae qui cupiditate eos quod.'

    $generate->title($gender = null|'male'|'female');     // 'Ms.'
    $generate->titleMale;                                 // 'Mr.'
    $generate->titleFemale;                               // 'Ms.'
    $generate->suffix;                                    // 'Jr.'
    $generate->name($gender = null|'male'|'female');      // 'Dr. Zane Stroman'
    $generate->firstName($gender = null|'male'|'female'); // 'Maynard'
    $generate->firstNameMale;                             // 'Maynard'
    $generate->firstNameFemale;                           // 'Rachel'
    $generate->lastName;                                  // 'Zulauf'

    $generate->cityPrefix;                          // 'Lake'
    $generate->secondaryAddress;                    // 'Suite 961'
    $generate->state;                               // 'NewMexico'
    $generate->stateAbbr;                           // 'OH'
    $generate->citySuffix;                          // 'borough'
    $generate->streetSuffix;                        // 'Keys'
    $generate->buildingNumber;                      // '484'
    $generate->city;                                // 'West Judge'
    $generate->streetName;                          // 'Keegan Trail'
    $generate->streetAddress;                       // '439 Karley Loaf Suite 897'
    $generate->postcode;                            // '17916'
    $generate->address;                             // '8888 Cummings Vista Apt. 101, Susanbury, NY 95473'
    $generate->country;                             // 'Falkland Islands (Malvinas)'
    $generate->latitude($min = -90, $max = 90);     // 77.147489
    $generate->longitude($min = -180, $max = 180);  // 86.211205

    $generate->phoneNumber;             // '201-886-0269 x3767'
    $generate->tollFreePhoneNumber;     // '(888) 937-7238'
    $generate->e164PhoneNumber;     // '+27113456789'

    $generate->catchPhrase;             // 'Monitored regional contingency'
    $generate->bs;                      // 'e-enable robust architectures'
    $generate->company;                 // 'Bogan-Treutel'
    $generate->companySuffix;           // 'and Sons'
    $generate->jobTitle;                // 'Cashier'

    $generate->realText($maxNbChars = 200, $indexSize = 2); // "And yet I wish you could manage it?) 'And what are they made of?' Alice asked in a shrill, passionate voice. 'Would YOU like cats if you were never even spoke to Time!' 'Perhaps not,' Alice replied."

    $generate->unixTime($max = 'now');                // 58781813
    $generate->dateTime($max = 'now', $timezone = null); // DateTime('2008-04-25 08:37:17', 'UTC')
    $generate->dateTimeAD($max = 'now', $timezone = null); // DateTime('1800-04-29 20:38:49', 'Europe/Paris')
    $generate->iso8601($max = 'now');                 // '1978-12-09T10:10:29+0000'
    $generate->date($format = 'Y-m-d', $max = 'now'); // '1979-06-09'
    $generate->time($format = 'H:i:s', $max = 'now'); // '20:49:42'
    $generate->dateTimeBetween($startDate = '-30 years', $endDate = 'now', $timezone = null); // DateTime('2003-03-15 02:00:49', 'Africa/Lagos')
    $generate->dateTimeInInterval($startDate = '-30 years', $interval = '+ 5 days', $timezone = null); // DateTime('2003-03-15 02:00:49', 'Antartica/Vostok')
    $generate->dateTimeThisCentury($max = 'now', $timezone = null);     // DateTime('1915-05-30 19:28:21', 'UTC')
    $generate->dateTimeThisDecade($max = 'now', $timezone = null);      // DateTime('2007-05-29 22:30:48', 'Europe/Paris')
    $generate->dateTimeThisYear($max = 'now', $timezone = null);        // DateTime('2011-02-27 20:52:14', 'Africa/Lagos')
    $generate->dateTimeThisMonth($max = 'now', $timezone = null);       // DateTime('2011-10-23 13:46:23', 'Antarctica/Vostok')
    $generate->amPm($max = 'now');                    // 'pm'
    $generate->dayOfMonth($max = 'now');              // '04'
    $generate->dayOfWeek($max = 'now');               // 'Friday'
    $generate->month($max = 'now');                   // '06'
    $generate->monthName($max = 'now');               // 'January'
    $generate->year($max = 'now');                    // '1993'
    $generate->century;                               // 'VI'
    $generate->timezone;                             // 'Europe/Paris'

    $generate->email;                  // '[email protected]'
    $generate->safeEmail;               // '[email protected]'
    $generate->freeEmail;               // '[email protected]'
    $generate->companyEmail;            // '[email protected]'
    $generate->freeEmailDomain;         // 'yahoo.com'
    $generate->safeEmailDomain;         // 'example.org'
    $generate->userName;                // 'wade55'
    $generate->password;                // 'k&|X+a45*2['
    $generate->domainName;              // 'wolffdeckow.net'
    $generate->domainWord;              // 'feeney'
    $generate->tld;                     // 'biz'
    $generate->url;                     // 'http://www.skilesdonnelly.biz/aut-accusantium-ut-architecto-sit-et.html'
    $generate->slug;                    // 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum'
    $generate->ipv4;                    // '109.133.32.252'
    $generate->localIpv4;               // '10.242.58.8'
    $generate->ipv6;                    // '8e65:933d:22ee:a232:f1c1:2741:1f10:117c'
    $generate->macAddress;              // '43:85:B7:08:10:CA'

    $generate->userAgent;              // 'Mozilla/5.0 (Windows CE) AppleWebKit/5350 (KHTML, like Gecko) Chrome/13.0.888.0 Safari/5350'
    $generate->chrome;                 // 'Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_5) AppleWebKit/5312 (KHTML, like Gecko) Chrome/14.0.894.0 Safari/5312'
    $generate->firefox;                // 'Mozilla/5.0 (X11; Linuxi686; rv:7.0) Gecko/20101231 Firefox/3.6'
    $generate->safari;                 // 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_7_1 rv:3.0; en-US) AppleWebKit/534.11.3 (KHTML, like Gecko) Version/4.0 Safari/534.11.3'
    $generate->opera;                  // 'Opera/8.25 (Windows NT 5.1; en-US) Presto/2.9.188 Version/10.00'
    $generate->internetExplorer;       // 'Mozilla/5.0 (compatible; MSIE 7.0; Windows 98; Win 9x 4.90; Trident/3.0)'

    $generate->creditCardType;          // 'MasterCard'
    $generate->creditCardNumber;        // '4485480221084675'
    $generate->creditCardExpirationDate; // 04/13
    $generate->creditCardExpirationDateString; // '04/13'
    $generate->creditCardDetails;       // array('MasterCard', '4485480221084675', 'Aleksander Nowak', '04/13')
    // Generates a random IBAN. Set $countryCode to null for a random country
    $generate->iban($countryCode);      // 'IT31A8497112740YZ575DJ28BP4'
    s$generate->wiftBicNumber;          // 'RZTIAT22263'

    $generate->hexcolor;               // '#fa3cc2'
    $generate->rgbcolor;               // '0,255,122'
    $generate->rgbColorAsArray;        // array(0,255,122)
    $generate->rgbCssColor;            // 'rgb(0,255,122)'
    $generate->safeColorName;          // 'fuchsia'
    $generate->colorName;              // 'Gainsbor'
    $generate->hslColor;               // '340,50,20'
    $generate->hslColorAsArray;       // array(340,50,20)

    $generate->fileExtension;          // 'avi'
    $generate->mimeType;               // 'video/x-msvideo'
    // Copy a random file from the source to the target directory and returns the fullpath or filename
    $generate->file($sourceDir = '/tmp', $targetDir = '/tmp'); // '/path/to/targetDir/13b73edae8443990be1aa8f1a483bc27.jpg'
    $generate->file($sourceDir, $targetDir, false); // '13b73edae8443990be1aa8f1a483bc27.jpg'

    // Image generation provided by LoremPixel (http://lorempixel.com/)
    $generate->imageUrl($width = 640, $height = 480); // 'http://lorempixel.com/640/480/'
    $generate->imageUrl($width, $height, 'cats');     // 'http://lorempixel.com/800/600/cats/'
    $generate->imageUrl($width, $height, 'cats', true, 'Faker'); // 'http://lorempixel.com/800/400/cats/Faker'
    $generate->imageUrl($width, $height, 'cats', true, 'Faker', true); // 'http://lorempixel.com/gray/800/400/cats/Faker/' Monochrome image
    $generate->image($dir = '/tmp', $width = 640, $height = 480); // '/tmp/13b73edae8443990be1aa8f1a483bc27.jpg'
    $generate->image($dir, $width, $height, 'cats');  // 'tmp/13b73edae8443990be1aa8f1a483bc27.jpg' it's a cat!
    $generate->image($dir, $width, $height, 'cats', false); // '13b73edae8443990be1aa8f1a483bc27.jpg' it's a filename without path
    $generate->image($dir, $width, $height, 'cats', true, false); // it's a no randomize images (default: `true`)
    $generate->image($dir, $width, $height, 'cats', true, true, 'Faker'); // 'tmp/13b73edae8443990be1aa8f1a483bc27.jpg' it's a cat with 'Faker' text. Default, `null`.

    $generate->uuid;                   // '7e57d004-2b97-0e7a-b45f-5387367791cd'

    $generate->ean13;         // '4006381333931'
    $generate->ean8;           // '73513537'
    $generate->isbn13;         // '9790404436093'
    $generate->isbn10;         // '4881416324'

    $generate->boolean; // false
    $generate->boolean($chanceOfGettingTrue = 50); // true
    $generate->md5;           // 'de99a620c50f2990e87144735cd357e7'
    $generate->sha1;          // 'f08e7f04ca1a413807ebc47551a40a20a0b4de5c'
    $generate->sha256;        // '0061e4c60dac5c1d82db0135a42e00c89ae3a333e7c26485321f24348c7e98a5'
    $generate->locale;        // en_UK
    $generate->countryCode;   // UK
    $generate->languageCode;  // en
    $generate->currencyCode;  // EUR
    $generate->emoji;         // 😁

    // get a random number between 10 and 20,
    // with more chances to be close to 20
    $generate->biasedNumberBetween($min = 10, $max = 20, $function = 'sqrt');

    //Generate HTML document which is no more than 2 levels deep, and no more than 3 elements wide at any level.
    $generate->randomHtml(2,3);   // <html> content .... </html>

// Allow to add cookie
Cookies::add($key, $value, $day);
// Allow to get cookie
Cookies::get($key)
// Allow to delete cookie
Cookies::delete($key)
// Allow to check if cookie is enabled
Cookies::check()

// Allow to start session
Session::init();
// Allow to create session item
Session::add($key, $value);
// Allow to get session item
Session::get($key);
// Allow to delete session item
Session::delete($key);
// Allow to destroy all session
Session::destroy()

$files = Upload::dir("/assets/uploaded/")->param("files")->randomName(true)->Start();

$email = new Email();
$email->init($host, $username, $password, $is_html = false, $security = 'ssl', $port = 465);
$email->from($email, $name);
$email->to($email, $name);
$email->template($subject, $title, $body);
$email->sendEmail();

 Lang::init()->setLocale('fr-fr');

// In php functions
$translated = Lang::init()->Trans($text)

// In file
 
$keywords = array(
    'Hello' => 'Hello',
    'ToDay' => 'ToDay',
    'Morning' => 'Morning',
    'Night' => 'Night',
);

 $langList = Lang::init()->getLangIndex();

$cols->init([
    'allowedOrigins' => '*',
    'allowedMethods' => 'POST, DELETE, PUT, PATCH, OPTIONS',
    'allowedHeaders' => 'Content-Type, Authorization, X-Requested-With',
    'maxAge' => 10000,
]);

// Allow to add flashdata
FlashData::Add($key, $data);

// Get that data and get destroyed
FlashData::Get($key);

# output: /current-url
url();

# we check if the current url contains the `/api` part.
if(url()->contains('/api')) {
    // ... do stuff
}
# Grab the query-string parameter id from the current-url.
$id = url()->getParam('id');

# Get the absolute url for the current url.
$absoluteUrl = url()->getAbsoluteUrl();

$name = input('name', 'Guest', 'post', 'get');

$object = input()->find($index, $defaultValue = null, ...$methods);

$object = input()->get($index, $defaultValue = null);

$object = input()->post($index, $defaultValue = null);

$object = input()->file($index, $defaultValue = null);

# Get all
$values = input()->all();

# Only match specific keys
$values = input()->all([
    'company_name',
    'user_id'
]);

cutText($string, $length, $more_icon = '...');

isContain($string, $prefix);

paginate($data, $number_of_items_to_show, $page_number);

getToken($length = 8, $type = 'string'); // or number

responce($data,$http_code);

_env($value,$default_value)
 
# For checking php version
php -v 
 
php run serve
 
php run serve 8001
 
# This command is for installing  php composer packages
composer install
 
# This command is for running php server
php run serve
 
php run serve 8001

/config/routes.php

app/controllers/[folder name]/home.php

# Use this file located here
config/migration.php

# Use this file located here
config/seeder.php