PHPackages                             grayloon/laravel-magento-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. grayloon/laravel-magento-api

Abandoned → [justbetter/laravel-magento-client](/?search=justbetter%2Flaravel-magento-client)ArchivedLibrary[API Development](/categories/api)

grayloon/laravel-magento-api
============================

Magento 2 REST API Wrapper to export Magento data to use in your Laravel application.

0.17.0(3y ago)5857.7k↓47.8%49[1 issues](https://github.com/grayloon/magento-laravel-api/issues)1MITPHPPHP ^7.3|^8.0

Since Jul 28Pushed 3y ago5 watchersCompare

[ Source](https://github.com/grayloon/magento-laravel-api)[ Packagist](https://packagist.org/packages/grayloon/laravel-magento-api)[ Docs](https://github.com/grayloon/laravel-magento-api)[ RSS](/packages/grayloon-laravel-magento-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (23)Used By (1)

Note: This package is [no longer maintained](https://github.com/grayloon/magento-laravel-api/issues/93). Please use the [justbetter/laravel-magento-client](https://github.com/justbetter/laravel-magento-client) package.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#note-this-package-is-no-longer-maintained-please-use-the-justbetterlaravel-magento-client-package)

 [![](logo.png)](logo.png)

[![Build Status](https://github.com/grayloon/magento-laravel-api/workflows/tests/badge.svg)](https://github.com/grayloon/magento-laravel-api/actions)[![Latest Stable Version](https://camo.githubusercontent.com/c07bd92d936051c445a660d93ff5221e21b81d6689fbc4d2d934aa60ba9914a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f677261796c6f6f6e2f6c61726176656c2d6d6167656e746f2d6170692e7376673f7374796c653d666c6174)](https://packagist.org/packages/grayloon/magento-laravel-api)[![Style CI](https://camo.githubusercontent.com/d9ac2be491939e544dc9c9657266b3c450f48b5fec10b085061014828e7c22be/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3237373538353131392f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/277585119?branch=master)[![Total Downloads](https://camo.githubusercontent.com/c7711331a76d734955e8515094589e1392542d0d40447b3f065e19af8d5a61c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f677261796c6f6f6e2f6c61726176656c2d6d6167656e746f2d6170693f7374796c653d666c6174)](https://packagist.org/packages/grayloon/magento-laravel-api)[![License](https://camo.githubusercontent.com/1a2e0606685ce00663bf829868f794fd3fc9c86f8d80cae324734129e0723a58/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e737667)](https://packagist.org/packages/grayloon/magento-laravel-api)

Laravel - Magento API
=====================

[](#laravel---magento-api)

About
-----

[](#about)

A Magento 2 API Object Oriented wrapper for a Laravel application.

- [Installation](#installation)
- [API Usage](#api-usage)
- [Available Methods](#available-methods)
    - [Admin Token](#admin-token)
    - [Bundle Products](#bundle-products)
    - [Carts](#carts)
    - [Categories](#categories)
    - [Customer Token](#customer-token)
    - [Customers](#customers)
    - [Customer Groups](#customer-groups)
    - [Guest Cart](#guest-cart)
    - [Orders](#orders)
    - [Product Attributes](#product-attributes)
    - [Product Link Types](#product-link-types)
    - [Products](#products)
    - [Schema](#schema)
    - [Source Items](#source-items)
    - [Sources](#sources)
    - [Stocks]($stocks)
    - [Custom Modules](#custom-modules)

Installation
------------

[](#installation)

Install this package via Composer:

```
composer require grayloon/laravel-magento-api
```

Publish the config options:

```
php artisan vendor:publish --provider="Grayloon\Magento\MagentoServiceProvider"
```

Configure your Magento 2 API endpoint and token in your `.env` file:

```
MAGENTO_BASE_URL="https://mydomain.com"
MAGENTO_ACCESS_TOKEN="client_access_token_here"

# Optional Config:
MAGENTO_BASE_PATH="rest"
MAGENTO_STORE_CODE="all"
MAGENTO_API_VERSION="V1"

```

API Usage
---------

[](#api-usage)

Example:

```
use Grayloon\Magento\Magento;

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

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

> Will throw an exception on &gt;500 errors.

You may also utilize the constructor directly without having to configure environment variables:

```
use Grayloon\Magento\Magento;

$magento = new Magento(
    $baseUrl = 'https://my-magento-shop.com',
    $token = 'client_access_token',
    $version = 'V1',
    $basePath = 'rest',
    $storeCode = 'default'
);

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

Available Methods:
------------------

[](#available-methods)

### Admin Token Integration (IntegrationAdminTokenServiceV1)

[](#admin-token-integration-integrationadmintokenservicev1)

`/V1/integration/admin/token`

Generate a admin token:

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

### Bundle Product Options (bundleProductOptionRepositoryV1)

[](#bundle-product-options-bundleproductoptionrepositoryv1)

`/V1/bundle-products/{sku}/options/all`

Get all options for bundle product.

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

#### Carts

[](#carts)

`/V1/carts/mine`

Returns information for the cart for the authenticated customer. Must use a single store code.

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

`/V1/carts/mine/coupons/{couponCode}`

Apply a coupon to a specified cart.

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

#### Cart Items (quoteCartItemRepositoryV1)

[](#cart-items-quotecartitemrepositoryv1)

`/V1/carts/mine/items/`

Lists items that are assigned to a specified customer cart. Must have a store code.

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

`/V1/carts/mine/items/`

Add/update the specified cart item with a customer token. Must have a store code.

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

`put` - `/V1/carts/mine/items/{itemId}`

Update the specified cart item with a customer token. Must have a store code.

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

Remove the specified cart item with a customer token. Must have a store code.

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

#### Cart Totals (quoteCartTotalRepositoryV1)

[](#cart-totals-quotecarttotalrepositoryv1)

`/V1/carts/mine/totals`

Returns information for the cart totals for the authenticated customer. Must use a single store code.

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

### Categories (catalogCategoryManagementV1)

[](#categories-catalogcategorymanagementv1)

`/V1/categories`

Get a list of all categories:

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

### Customer Token Integration (IntegrationCustomerTokenServiceV1)

[](#customer-token-integration-integrationcustomertokenservicev1)

`/V1/integration/customer/token`

Generate a customer token:

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

### Customers (various)

[](#customers-various)

`/V1/customers/search`

Get a list of customers:

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

`/V1/customers/password`

Send an email to the customer with a password reset link.

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

`/V1/customers/resetPassword`

Reset customer password.

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

### Customer Groups

[](#customer-groups)

GET `/V1/customerGroups/{id}`

Show the customer group by the provided ID.

```
Magento::api('customerGroups')->show($id);
```

PUT `/V1/customerGroups/{id}`

Save the customer group by the provided ID.

```
Magento::api('customerGroups')->saveGroup($id, $customerGroupRepositoryV1SavePutBody = []);
```

DELETE `/V1/customerGroups/{id}`

Delete customer group by the provided ID.

```
Magento::api('customerGroups')->deleteGroup($id);
```

POST `/V1/customerGroups`

Save/Create Customer Group.

```
Magento::api('customerGroups')->createGroup($customerGroupRepositoryV1SavePostBody = []);
```

GET `/V1/customerGroups/search`

Search the Customer Groups.

```
Magento::api('customerGroups')->search($pageSize = 50, $currentPage = 1, $filters = []);
```

GET `/V1/customerGroups/default`

Get the default customer group.

```
Magento::api('customerGroups')->default();
```

PUT `/V1/customerGroups/default/{id}`

Set the default customer group.

```
Magento::api('customerGroups')->setDefault($id);
```

GET `/V1/customerGroups/{id}/permissions`

Determine if customer group can be deleted.

```
Magento::api('customerGroups')->permissions($id);
```

### Guest Cart (various)

[](#guest-cart-various)

`/V1/guest-carts`

Enable customer or guest user to create an empty cart and quote for an anonymous customer.

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

`/V1/guest-carts/{cartId}`

Return information for a specified cart.

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

`/V1/guest-carts/{cartId}/items`

List items that are assigned to a specified cart.

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

`/V1/guest-carts/{cartId}/items`

Add/update the specified cart item.

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

`put` - `/V1/guest-carts/{cartId}/items/{itemId}`

Update the specified cart item.

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

Remove the specified cart item.

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

`/V1/guest-carts/{cartId}/estimate-shipping-methods`

Estimate shipping by address and return list of available shipping methods.

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

`/V1/guest-carts/{cartId}/coupons/{couponCode}`

Apply a coupon to a specified cart.

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

`/V1/guest-carts/{cartId}`

Assign a specified customer to a specified shopping cart.

```
Magento::api('guestCarts')->assignCustomer($cartId, $customerId, $storeId);
```

### Orders (salesOrderRepositoryV1)

[](#orders-salesorderrepositoryv1)

Lists orders that match specified search criteria.

`/V1/orders`

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

`/V1/orders/{id}`

List a specified order:

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

`/V1/orders`

[Performs persist operations for a specified order.](https://magento.redoc.ly/2.4.3-admin/tag/orders#operation/salesOrderRepositoryV1SavePost)

```
Magento::api('orders')->edit($entity = []);
```

### Product Attributes (catalogProductAttributeRepositoryV1)

[](#product-attributes-catalogproductattributerepositoryv1)

`/V1/products/attributes/{attributeCode}`

Retrieve specific product attribute information:

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

### Product Link Types (catalogProductLinkTypeListV1)

[](#product-link-types-catalogproductlinktypelistv1)

`/V1/products/links/types`

Retrieve information about available product link types:

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

### Products (catalogProductRepositoryV1)

[](#products-catalogproductrepositoryv1)

`/V1/products`

Get a list of products:

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

`/V1/products/{sku}`

Get info about a product by the product SKU:

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

### Custom Modules

[](#custom-modules)

Magento modules can have their own API endpoints. For example:

```

    ...

    ...

```

To use these you can directly use get/post methods:

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

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

### Schema

[](#schema)

Get a schema blueprint of the Magento 2 REST API:

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

### Source Items (inventoryApiSourceItemRepositoryV1)

[](#source-items-inventoryapisourceitemrepositoryv1)

`/V1/inventory/source-items`

Get a list of paginated sort items (typically used for quantity retrieval):

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

### Sources (inventoryApiSourcesRepositoryV1)

[](#sources-inventoryapisourcesrepositoryv1)

`/V1/inventory/sources`

Get a list of paginated sources.

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

`/V1/inventory/sources/{$name}`

Get a specified source.

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

### Stocks (inventoryApiStocksRepositoryV1)

[](#stocks-inventoryapistocksrepositoryv1)

`/V1/inventory/stocks`

Get a list of paginated stocks.

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

### Store (storeGroupRepositoryV1)

[](#store-storegrouprepositoryv1)

`/V1/store/storeConfigs`

Get a list of store configs.

```
Magento::api('store')->storeConfigs();
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Gray Loon Marketing Group](https://github.com/grayloon)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~37 days

Recently: every ~84 days

Total

22

Last Release

1341d ago

PHP version history (3 changes)0.1PHP ^7.4

0.4PHP ^7.3

0.8.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5503346?v=4)[Gray Loon](/maintainers/grayloon)[@grayloon](https://github.com/grayloon)

---

Top Contributors

[![ahinkle](https://avatars.githubusercontent.com/u/17038330?v=4)](https://github.com/ahinkle "ahinkle (347 commits)")[![Mushood](https://avatars.githubusercontent.com/u/17172604?v=4)](https://github.com/Mushood "Mushood (11 commits)")[![VincentBean](https://avatars.githubusercontent.com/u/3906942?v=4)](https://github.com/VincentBean "VincentBean (6 commits)")[![zkimffm](https://avatars.githubusercontent.com/u/70184283?v=4)](https://github.com/zkimffm "zkimffm (6 commits)")[![matt-gribben](https://avatars.githubusercontent.com/u/5528690?v=4)](https://github.com/matt-gribben "matt-gribben (5 commits)")[![ramonrietdijk](https://avatars.githubusercontent.com/u/85165272?v=4)](https://github.com/ramonrietdijk "ramonrietdijk (3 commits)")[![shoeyn](https://avatars.githubusercontent.com/u/793761?v=4)](https://github.com/shoeyn "shoeyn (2 commits)")[![jeroen-hso](https://avatars.githubusercontent.com/u/82658222?v=4)](https://github.com/jeroen-hso "jeroen-hso (2 commits)")[![jonathanribas](https://avatars.githubusercontent.com/u/3003782?v=4)](https://github.com/jonathanribas "jonathanribas (1 commits)")[![matusstafura](https://avatars.githubusercontent.com/u/11353888?v=4)](https://github.com/matusstafura "matusstafura (1 commits)")

---

Tags

hacktoberfestlaravel-packagemagento-apimagento2grayloonlaravel-magento-api

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/grayloon-laravel-magento-api/health.svg)

```
[![Health](https://phpackages.com/badges/grayloon-laravel-magento-api/health.svg)](https://phpackages.com/packages/grayloon-laravel-magento-api)
```

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1344.8k1](/packages/jasara-php-amzn-selling-partner-api)[grantholle/powerschool-api

A Laravel package to make interacting with PowerSchool less painful.

1715.6k1](/packages/grantholle-powerschool-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
