PHP code example of quangtam / laravel-wordpress-client

1. Go to this page and download the library: Download quangtam/laravel-wordpress-client 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/ */

    

quangtam / laravel-wordpress-client example snippets


$wordpress = new WordpressClient();

$response = $wordpress->categories();
$response = $wordpress->media();
$response = $wordpress->pages();
$response = $wordpress->posts();
$response = $wordpress->statuses();
$response = $wordpress->tags();
$response = $wordpress->taxonomies();
$response = $wordpress->types();
$response = $wordpress->users();

$response = Wordpress::categories();

$response = Wordpress::posts(['page' => 1, 'per_page' => 1]);

$response = Wordpress::posts(['page' => 1, 'per_page' => 1])->json();

$response = Wordpress::posts(['page' => 1, 'per_page' => 1])->collection();
bash
$ php artisan vendor:publish --laravel-wordpress
text
WP_API_URL=