Download the PHP package chez14/f3-ilgar without Composer
On this page you can find all versions of the php package chez14/f3-ilgar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chez14/f3-ilgar
More information about chez14/f3-ilgar
Files in chez14/f3-ilgar
Package f3-ilgar
Short Description A simple migration tool for Fat-Free Framework
License GPL-3.0-only
Homepage https://github.com/chez14/f3-ilgar
Informations about the package f3-ilgar
Ilgar
Quick and simple migration tool for Fat-Free Framework.
Getting Started
-
Install via Composer
-
Decide your bombarding option
-
Do it with default configuration? Default settings:
-
Call
/ilgar/migrate
to do migration -
Use
Migration
as your migration class namespace prefix - Migration packets placed in a
Migration
ormigration
folder in your project root folder.
Then, just add this to your
index.php
file: -
-
Do it with your own style and custom security?
Just invoke
\Chez14\Ilgar\Boot::trigger_on();
Anywhere at your controller. This will trigger migration process and returns quick stats.
-
-
Create your first ever migration packet
-
Deploy migration by accessing
/ilgar/migrate
or
MigrationPacket
Class Example
This file is available on your migration
folder, located on your project root folder. Alternatively you can set the folder by setting ILGAR.path
.
IMPORTANT! The file name should be formatted as "0-classname.php", where the 0 is any number (you can use just normal number 1-ClassName.php
, or CI-style timestamp 180901012400-ClassName.php
), seperated with single dash, and followed with your class name, either in lowercase, SnakeCase, or camelCase.
IMPORTANT! You need to extends \Chez14\Ilgar\MigrationPacket
class. This will ensure required methods is always available and dependable.
Here's your file: 1-test01.php
.
MigrationPacket
abstract class
It's just a normal class. With something that you need to implement:
on_migrate()
on_failed(\Exception $e)
Ilgar has 2 ability, bomb and self-destruct. Bomb means do the migration mission (on_migrate
), self-destruct means when it failed do the mission it will use their remaining power to do suicide bombing, in this matter, it means rollback the migration mission (on_failed
).
More convenient event-based functions (all of this is optional):
-
pre_migrate()
Before the migration event. This might be useful if you want to prepare something first.
Please check
is_migratable
if you want to wanted to do checks. -
post_migrate()
After migration event. This will be executed when the packet were successfully executed.
-
is_migratable()
Validates current packet if it is applicable. This must return true in order to make this packet executed.
Quick Api for Ilgar
Ilgar's API is available on Chez14\Ilgar\Internal
class. It's a \Prefab
child class, do if you wanted to get it's instance, you can obtain the instance by calling Chez14\Ilgar\Internal::instance()
. Aaanyway, here's the API list:
get_current_version()
returns an int
.
This integer represent current migration version point, declared by the filename.
Will load the version from migration.json
.
reset_version()
returns void.
Will forcefully delete migration.json
at designated path.
get_stats()
returns quick stats.
This will return current statistics with the migrations.
Quick Stats
Quick stats is a array, consisting:
License
Yes, GPLv3.
FAQ and RAQ (Rarely Asked Question)
Why naming it "Ilgar"?
Ilgar is a bombarding-type Trion Warrior. It's used by Aftocrator and Chion for invasion. Yes, it's meant to bombarding the database with migration packets.