PHPackages                             pixelpeter/laravel5-woocommerce-api-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. pixelpeter/laravel5-woocommerce-api-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

pixelpeter/laravel5-woocommerce-api-client
==========================================

Laravel 5 wrapper for the Woocommerce REST API

v3.0.1(8y ago)125103.4k↓37.2%50[6 issues](https://github.com/pixelpeter/laravel5-woocommerce-api-client/issues)[3 PRs](https://github.com/pixelpeter/laravel5-woocommerce-api-client/pulls)MITPHPPHP ^7.0CI passing

Since Jan 20Pushed 4mo ago10 watchersCompare

[ Source](https://github.com/pixelpeter/laravel5-woocommerce-api-client)[ Packagist](https://packagist.org/packages/pixelpeter/laravel5-woocommerce-api-client)[ Docs](https://github.com/pixelpeter/laravel5-woocommerce-api-client)[ RSS](/packages/pixelpeter-laravel5-woocommerce-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (12)Used By (0)

Laravel 5 WooCommerce API Client
================================

[](#laravel-5-woocommerce-api-client)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7d9906df9388de3c6e643c80a5c7972864f1d36fbd26b3bd4b083ac0f6d70590/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706978656c70657465722f6c61726176656c352d776f6f636f6d6d657263652d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pixelpeter/laravel5-woocommerce-api-client)[![Total Downloads](https://camo.githubusercontent.com/f48aca117a6ac8895bec490572b59e84a39e43c60c40d3b7e84ba29c1e2ee4f8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706978656c70657465722f6c61726176656c352d776f6f636f6d6d657263652d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pixelpeter/laravel5-woocommerce-api-client)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Coverage Status](https://camo.githubusercontent.com/94435134d409f4c997069aa8e63e307c158d52b9f2f84ea1c6d5c757f13da452/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f706978656c70657465722f6c61726176656c352d776f6f636f6d6d657263652d6170692d636c69656e742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/pixelpeter/laravel5-woocommerce-api-client?branch=master)[![Tests](https://github.com/pixelpeter/laravel5-woocommerce-api-client/actions/workflows/run-tests.yml/badge.svg?branch=master)](https://github.com/pixelpeter/laravel5-woocommerce-api-client/actions/workflows/run-tests.yml)[![Fix PHP code style issues](https://github.com/pixelpeter/laravel5-woocommerce-api-client/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/pixelpeter/laravel5-woocommerce-api-client/actions/workflows/fix-php-code-style-issues.yml)[![PHPStan](https://github.com/pixelpeter/laravel5-woocommerce-api-client/actions/workflows/phpstan.yml/badge.svg)](https://github.com/pixelpeter/laravel5-woocommerce-api-client/actions/workflows/phpstan.yml)[![dependabot-auto-merge](https://github.com/pixelpeter/laravel5-woocommerce-api-client/actions/workflows/dependabot-auto-merge.yml/badge.svg)](https://github.com/pixelpeter/laravel5-woocommerce-api-client/actions/workflows/dependabot-auto-merge.yml)

A simple Laravel 5 wrapper for the [official WooCommerce REST API PHP Library](https://github.com/woothemes/wc-api-php) from Automattic.

Version overview
----------------

[](#version-overview)

Laravelwc-api-php usedWordpressWoocommerceWC API versionuse branch5.7+2.x4.4+3.5+v1, v2, v3master5.5+1.3.x4.4+3.0 - 3.4.xv1, v2, v3^3.05.4+1.3.x4.4+2.6 - 2.6.14v1, v2^2.05.31.3.x4.1+2.1 - 2.5.5legacy v1, legacy v2, legacy v3^1.0Installation
------------

[](#installation)

### Step 1: Install Through Composer

[](#step-1-install-through-composer)

For API Version v2, WooCommerce 3.0+, Wordpress 4.4+, php 7.0+, Laravel 5.5+ use the v3.x branch

```
composer require pixelpeter/laravel5-woocommerce-api-client ^3.0
```

For API Version v1, WooCommerce 2.6+, Wordpress 4.4+, Laravel 5.4+ use the v2.x branch

```
composer require pixelpeter/laravel5-woocommerce-api-client ^2.0
```

For older versions of Woocommerce starting from 2.1+ use the v1.x branch

```
composer require pixelpeter/laravel5-woocommerce-api-client ^1.0
```

### Step 2: Add the Service Provider (not needed with v3.x)

[](#step-2-add-the-service-provider-not-needed-with-v3x)

Add the service provider in `app/config/app.php`

```
'provider' => [
    ...
    Pixelpeter\Woocommerce\WoocommerceServiceProvider::class,
    ...
];
```

### Step 3: Add the Facade (not needed with v3.x)

[](#step-3-add-the-facade-not-needed-with-v3x)

Add the alias in `app/config/app.php`

```
'aliases' => [
    ...
    'Woocommerce' => Pixelpeter\Woocommerce\Facades\Woocommerce::class,
    ...
];
```

### Step 4: Publish configuration

[](#step-4-publish-configuration)

```
php artisan vendor:publish --provider="Pixelpeter\Woocommerce\WoocommerceServiceProvider"
```

### Step 5: Customize configuration

[](#step-5-customize-configuration)

You can directly edit the configuration in `config/woocommerce.php` or copy these values to your `.env` file.

```
WOOCOMMERCE_STORE_URL=http://example.org
WOOCOMMERCE_CONSUMER_KEY=ck_your-consumer-key
WOOCOMMERCE_CONSUMER_SECRET=cs_your-consumer-secret
WOOCOMMERCE_VERIFY_SSL=false
WOOCOMMERCE_VERSION=v1
WOOCOMMERCE_WP_API=true
WOOCOMMERCE_WP_QUERY_STRING_AUTH=false
WOOCOMMERCE_WP_TIMEOUT=15
```

Examples
--------

[](#examples)

### Get the index of all available endpoints

[](#get-the-index-of-all-available-endpoints)

```
use Woocommerce;

return Woocommerce::get('');
```

### View all orders

[](#view-all-orders)

```
use Woocommerce;

return Woocommerce::get('orders');
```

### View all completed orders created after a specific date

[](#view-all-completed-orders-created-after-a-specific-date)

#### For legacy API versions

[](#for-legacy-api-versions)

(WC 2.4.x or later, WP 4.1 or later) use this syntax

```
use Woocommerce;

$data = [
    'status' => 'completed',
    'filter' => [
        'created_at_min' => '2016-01-14'
    ]
];

$result = Woocommerce::get('orders', $data);

foreach($result['orders'] as $order)
{
    // do something with $order
}

// you can also use array access
$orders = Woocommerce::get('orders', $data)['orders'];

foreach($orders as $order)
{
    // do something with $order
}
```

#### For current API versions

[](#for-current-api-versions)

(WC 2.6.x or later, WP 4.4 or later) use this syntax. `after` needs to be a ISO-8601 compliant date!≠

```
use Woocommerce;

$data = [
    'status' => 'completed',
    'after' => '2016-01-14T00:00:00'
    ]
];

$result = Woocommerce::get('orders', $data);

foreach($result['orders'] as $order)
{
    // do something with $order
}

// you can also use array access
$orders = Woocommerce::get('orders', $data)['orders'];

foreach($orders as $order)
{
    // do something with $order
}
```

### Update a product

[](#update-a-product)

```
use Woocommerce;

$data = [
    'product' => [
        'title' => 'Updated title'
    ]
];

return Woocommerce::put('products/1', $data);
```

### Pagination

[](#pagination)

So you don't have to mess around with the request and response header and the calculations this wrapper will do all the heavy lifting for you. (WC 2.6.x or later, WP 4.4 or later)

```
use Woocommerce;

// assuming we have 474 orders in pur result
// we will request page 5 with 25 results per page
$params = [
    'per_page' => 25,
    'page' => 5
];

Woocommerce::get('orders', $params);

Woocommerce::totalResults(); // 474
Woocommerce::firstPage(); // 1
Woocommerce::lastPage(); // 19
Woocommerce::currentPage(); // 5
Woocommerce::totalPages(); // 19
Woocommerce::previousPage(); // 4
Woocommerce::nextPage(); // 6
Woocommerce::hasPreviousPage(); // true
Woocommerce::hasNextPage(); // true
Woocommerce::hasNotPreviousPage(); // false
Woocommerce::hasNotNextPage(); // false
```

In some cases the web server returns headers only in lower case. This may cause errors when using the pagination functions. If that is your case, call the following method before calling any pagination methods.

```
use Woocommerce;

Woocommerce::useLowerCaseHeaders();
```

### HTTP Request &amp; Response (Headers)

[](#http-request--response-headers)

```
use Woocommerce;

// first send a request
Woocommerce::get('orders');

// get the request
Woocommerce::getRequest();

// get the response headers
Woocommerce::getResponse();

// get the total number of results
Woocommerce::getResponse()->getHeaders()['X-WP-Total']
```

### More Examples

[](#more-examples)

Refer to [WooCommerce REST API Documentation](https://woocommerce.github.io/woocommerce-rest-api-docs) for more examples and documention.

Testing
-------

[](#testing)

Run the tests with:

```
vendor/bin/phpunit
```

License
-------

[](#license)

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

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance51

Moderate activity, may be stable

Popularity48

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 76.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 ~100 days

Total

8

Last Release

3066d ago

Major Versions

v1.0.1 → v2.0.02016-07-19

v2.3.0 → v3.0.02017-07-10

PHP version history (2 changes)v1.0PHP &gt;=5.5.9

v3.0.0PHP ^7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6502630?v=4)[pixelpeter](/maintainers/pixelpeter)[@pixelpeter](https://github.com/pixelpeter)

---

Top Contributors

[![pixelpeter](https://avatars.githubusercontent.com/u/6502630?v=4)](https://github.com/pixelpeter "pixelpeter (42 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (2 commits)")[![leeroyrose](https://avatars.githubusercontent.com/u/3706842?v=4)](https://github.com/leeroyrose "leeroyrose (1 commits)")[![palpalani](https://avatars.githubusercontent.com/u/716695?v=4)](https://github.com/palpalani "palpalani (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![stromgren](https://avatars.githubusercontent.com/u/971993?v=4)](https://github.com/stromgren "stromgren (1 commits)")[![ebisbe](https://avatars.githubusercontent.com/u/6747962?v=4)](https://github.com/ebisbe "ebisbe (1 commits)")[![jb000](https://avatars.githubusercontent.com/u/17474154?v=4)](https://github.com/jb000 "jb000 (1 commits)")

---

Tags

laravelrestwoocommercewordpressapilaravelwordpressrestshopecommercecarte-commercewoocommerce

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pixelpeter-laravel5-woocommerce-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/pixelpeter-laravel5-woocommerce-api-client/health.svg)](https://phpackages.com/packages/pixelpeter-laravel5-woocommerce-api-client)
```

###  Alternatives

[aimeos/aimeos-laravel

Cloud native, API first Laravel eCommerce package with integrated AI for ultra-fast online shops, marketplaces and complex B2B projects

8.6k214.7k3](/packages/aimeos-aimeos-laravel)[amsgames/laravel-shop

Package set to provide shop or e-commerce functionality (such as CART, ORDERS, TRANSACTIONS and ITEMS) to Laravel for customizable builds.

4775.9k](/packages/amsgames-laravel-shop)[lunarphp/stripe

Stripe payment driver for Lunar.

2055.8k4](/packages/lunarphp-stripe)[threesquared/laravel-wp-api

Laravel package for the Wordpress JSON REST API

1310.3k](/packages/threesquared-laravel-wp-api)[getcandy/core

GetCandy Laravel e-commerce core functionality.

156.6k3](/packages/getcandy-core)

PHPackages © 2026

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