PHP code example of decolipakira / laravel_woocommerce

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

    

decolipakira / laravel_woocommerce example snippets


'providers' => [
    ...
    DecolipAkira\WooCommerce\WooCommerceServiceProvider::class,
    ...
]

'aliases' => [
    ...
    'WooCommerce' => DecolipAkira\WooCommerce\Facades\WooCommerce::class,
    ...
]

use WooCommerce;

WooCommerce::get($endpoint, $parameters = []);

WooCommerce::post($endpoint, $data);

WooCommerce::put($endpoint, $data);

WooCommerce::delete($endpoint, $parameters = []);

WooCommerce::options($endpoint);

use WooCommerce;
 
// Array of response results.
$results = $woocommerce->get('orders');

// Last request data.
$lastRequest = WooCommerce::httpGetRequest();
$lastRequest->getUrl(); // Requested URL (string).
$lastRequest->getMethod(); // Request method (string).
$lastRequest->getParameters(); // Request parameters (array).
$lastRequest->getHeaders(); // Request headers (array).
$lastRequest->getBody(); // Request body (JSON).

// Last response data.
$lastResponse = WooCommerce::httpGetResponse();
$lastResponse->getCode(); // Response code (int).
$lastResponse->getHeaders(); // Response headers (array).
$lastResponse->getBody(); // Response body (JSON).
bash
$ php artisan vendor:publish --provider="DecolipAkira\WooCommerce\WooCommerceServiceProvider"