PHP code example of jarednova / mesh

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

    

jarednova / mesh example snippets


/* functions.php */
$post = new Mesh\Post('Hello World', 'post');
// add content...
$post->set('post_content', 'This is your first WordPress post');
// add custom fields...
$post->set('my_foo', 'bar');
// "thumbnail" is a reserved key to add post thumbnails
$post->set_image('thumbnail', 'http://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/STS120LaunchHiRes-edit1.jpg/490px-STS120LaunchHiRes-edit1.jpg');

/* functions.php */
$user = new Mesh\User('Jared Novack', 'subscriber');
// add content...
$user->set('description', 'Jared is cool');
// add custom fields...
$user->set('my_foo', 'bar');
// add images
$user->set_image('headshot', 'http://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/STS120LaunchHiRes-edit1.jpg/490px-STS120LaunchHiRes-edit1.jpg');

$loader = new Mesh\JSON_Loader(__DIR__.'/../static/data/mesh-data.json');