PHP code example of knowler / wp-capsule

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

    

knowler / wp-capsule example snippets


/** Autoload */
le */
new KnowlerKnows\WP\Capsule\Boot;

use KnowlerKnows\WP\Capsule\Capsule;

register_activation_hook(__FILE__, function () {
    Capsule::schema()->create('products', function ($table) {
        $table->increments('id');
        $table->string('name');
        $table->timestamps();
    });
});

register_deactivation_hook(__FILE__, function () {
    Capsule::schema()->dropIfExists('products');
});