PHP code example of prappo / wp-eloquent

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

    

prappo / wp-eloquent example snippets


use Prappo\WpEloquent\Application;

Application::bootWp();

use Prappo\WpEloquent\Application;

Application::boot([
    'driver'    => 'mysql',
    'host'      => 'localhost',
    'database'  => 'database',
    'username'  => 'root',
    'password'  => 'password',
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix'    => '',
]);

use Prappo\WpEloquent\Support\Facades\DB;
$users = DB::table('users')->where('votes', '>', 100)->get();

use Prappo\WpEloquent\Support\Facades\DB;
$results = DB::select('select * from users where id = ?', [1]);

use Prappo\WpEloquent\Support\Facades\Schema;
Schema::create('users', function ($table) {
    $table->increments('id');
    $table->string('email')->unique();
    $table->timestamps();
});

class User extends Prappo\WpEloquent\Database\Eloquent\Model {}

$users = User::where('votes', '>', 1)->get();