1. Go to this page and download the library: Download lumenpress/nimble 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/ */
lumenpress / nimble example snippets
$post = new Post;
$post->title = 'Hello World';
$post->content = 'This is a post.';
// meta
$post->meta->foo = 'bar';
$post->meta->arr = ['value1', 'value2'];
// taxonomy
$post->tax->category = 'category name';
$post->tax->post_tag = ['tag1', 'tag2'];
// acf
// text type
$post->acf->text = 'Text1';
// group type
$post->acf->hero = [
'image' => '/path/to/image.png',
'link' => 'http://'
];
// repeater type
$post->acf->slides = [
[
'image' => '/path/to/image.png',
'description' => 'some text1',
'link' => 'http://'
],
[
'image' => '/path/to/image.png',
'description' => 'some text2',
'link' => 'http://'
],
];
$post->save();
// query from post field
Page::where('field', 'value');
// query from post meta key
Page::where('meta.key', 'value');
// query from term taxonomy
Page::where('term.taxonomy', 'taxonomy');
// query from term name
Page::where('term.name', 'term name');
// query from term meta key
Page::where('term.meta.key', 'value');
// order by post field
Page::type('page')->orderBy('date', 'asc'); // asc & desc
// order by meta key value
Page::type('page')->orderBy('meta.key', 'desc');
Menu::location('main');
Menu::location('footer');
Menu::slug('main');
$menus = Menu::get();
$menus['main']; // location name
$menus[1]; // menu id