WordPress is a great CMS, but lacks MVC. Then I tried Laravel an awesome php framework loved by many. Hence, thought to create a bridge between WordPress & Laravel without losing the flexibility of a framework.
By installing this framework, you're actually install laravel as plugin and you'll be controlling the backend as well as the frontend of the plugin with no WordPress limitations.
You'll able to use almost everything similar to laravel like routes, controllers, migrations, models, blade templates etc
Create a folder as vaah-framework in your WordPress plugins folder extract this repository in the folder or clone this repository in your plugins folder.
Run following command to install all plugin dependencies.
composer installThen Run
composer dump-autoloadLogin to your WordPress admin > plugins and activate Vaah Framework. And plugin is ready for development.
Use any command line tool and navigate to Vaah plugins folder and run:
vendor\bin\phinx initPhinx is being used to manage migrations.
Run
php vaah create tableName --template=phinx-template.php.distThis will create a migration file under app/Migration/db folder.
Below is sample migration file. You may consider to read Phinx documentation to create these migration files. These are almost similar to laravel migration files.
use \Vaah\Migration\Migration;
class VaahTasks extends Migration
{
public function up()
{
$this->schema->create('vaah_tasks', function(Illuminate\Database\Schema\Blueprint $table){
// Auto-increment id
$table->increments('id');
$table->string('name')->nullable();
$table->integer('vaah_catogary_id')->nullable();
$table->timestamps();
});
}
//-----------------------------------------------------
public function down()
{
$this->schema->drop('vaah_tasks');
}
}Use following command to run migrations:
php vaah migrateUse following command to rollback migrations:
php vaah rollbackUse following command to reset migrations:
php vaah rollback -t 0