PHP code example of thezombieguy / wpc

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

    

thezombieguy / wpc example snippets


 print $test; 

 print wpc_theme('templates/test', array('test' => 'hello world')); 

$template = 'templates\test'
$theme = new \WPC\Theme($template);
$theme->set('test', 'hello world');
$content = $theme->fetch();
print $content;

$cache = new Cache(); 

$cache->set('myCacheData', array('fruit' => 'apple')); 

$myCacheData = $cache->get('myCacheData');

$cache->clear();

class MyClass
{ 
    public function myMethod($args)
    {
        wp_json_send($args);
    }
}

$endpoint = array(
    'regex' => '^api/numbers/([0-9]+)/([0-9]+)',
    'redirect' => 'index.php?__api=1&handler=MyClass&callback=myMethod&uid=$matches[1]&prize_id=$matches[2]',
    'after' => 'top',
)

$endpoints[] = $endpoint;

new WPC\Api($endpoints);