PHP code example of mucan / laravel-magento-api

1. Go to this page and download the library: Download mucan/laravel-magento-api 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/ */

    

mucan / laravel-magento-api example snippets


use Mucan\Magento\Magento;

$magento = new Magento();
$response = $magento->api('products')->all();

$response->body() : string;
$response->json() : array|mixed;
$response->status() : int;
$response->ok() : bool;

Magento::api('integration')->adminToken($username, $password);

Magento::api('bundleProduct')->options($sku);

Magento::api('carts')->mine();

Magento::api('carts')->couponCode($couponCode);

Magento::api('cartItems')->mine();

Magento::api('cartItems')->addItem($cartId, $sku, $quantity);

Magento::api('cartItems')->editItem($itemId, $body = []);

Magento::api('cartItems')->removeItem($itemId);

Magento::api('cartTotals')->mine();

Magento::api('categories')->all($pageSize = 50, $currentPage = 1, $filters = []);

Magento::api('integration')->customerToken($username, $password);

Magento::api('customers')->all($pageSize = 50, $currentPage = 1, $filters = []);

Magento::api('customers')->password($email, $template, $websiteId);

Magento::api('customers')->resetPassword($email, $resetToken, $newPassword);

Magento::api('guestCarts')->create();

Magento::api('guestCarts')->cart($cartId);

Magento::api('guestCarts')->items($cartId);

Magento::api('guestCarts')->addItem($cartId, $sku, $quantity);

Magento::api('guestCarts')->editItem($cartId, $itemId, $body = []);

Magento::api('guestCarts')->removeItem($cartId, $itemId);

Magento::api('guestCarts')->estimateShippingMethods($cartId);

Magento::api('guestCarts')->couponCode($cartId, $couponCode);

Magento::api('orders')->all($pageSize = 50, $currentPage = 1, $filters = []);

Magento::api('orders')->show($orderId);

Magento::api('productAttributes')->show($attributeCode);

Magento::api('productLinkType')->types();

Magento::api('products')->all($pageSize = 50, $currentPage = 1, $filters = []);

Magento::api('products')->show($sku);

Magento::api('my-custom-endpoint')->post('save', [...]);

Magento::api('my-custom-endpoint')->get('get/1');

Magento::api('schema')->show(); 

Magento::api('sourceItems')->all($pageSize = 50, $currentPage = 1, $filters = []);

Magento::api('sources')->all($pageSize = 50, $currentPage = 1, $filters = []);

Magento::api('sources')->bySourceName($name);

Magento::api('stocks')->all($pageSize = 50, $currentPage = 1, $filters = []);
bash
php artisan vendor:publish --provider="Mucan\Magento\MagentoServiceProvider" --tag="config"