https://github.com/codexshaper/woocommerce-php-sdk
WooCommerce PHP SDK
https://github.com/codexshaper/woocommerce-php-sdk
php rest sdk woocommerce
Last synced: 8 months ago
JSON representation
WooCommerce PHP SDK
- Host: GitHub
- URL: https://github.com/codexshaper/woocommerce-php-sdk
- Owner: Codexshaper
- License: mit
- Created: 2020-05-11T08:19:47.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-11T12:00:14.000Z (almost 6 years ago)
- Last Synced: 2025-06-08T21:43:40.702Z (9 months ago)
- Topics: php, rest, sdk, woocommerce
- Language: PHP
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](http://badges.mit-license.org)
[](https://travis-ci.org/Codexshaper/woocommerce-php-sdk)
[](https://github.styleci.io/repos/262981821)
[](https://scrutinizer-ci.com/g/Codexshaper/woocommerce-php-sdk)
[](https://packagist.org/packages/Codexshaper/woocommerce-php-sdk)
[](https://packagist.org/packages/Codexshaper/laravel-woocommerce)
# Description
WooCommerce Rest API for Laravel. You can Get, Create, Update and Delete your woocommerce product using this package easily.
[Documentation](https://codexshaper.github.io/docs/laravel-woocommerce/)
## Authors
* **Md Abu Ahsan Basir** - [github](https://github.com/maab16)
## License
- **[MIT license](http://opensource.org/licenses/mit-license.php)**
- Copyright 2020 © CodexShaper.
# Eloquent Style for Product, Customer and Order
```
// Where passing multiple parameters
$products = Product::where('title','hello')->get();
OR
// You can call field with where clause
$products = Product::whereTitle('hello')->get();
// Fields name are more than one words or seperate by underscore (_). For example field name is `min_price`
$products = Product::whereMinPrice(5)->get();
// Where passing an array
$orders = Order::where(['status' => 'processing']);
$orders = Order::where(['status' => 'processing', 'orderby' => 'id', 'order' => 'asc'])->get();
// Set Options
$orders = Order::options(['status' => 'processing', 'orderby' => 'id', 'order' => 'asc'])->get();
// You can set options by passing an array when call `all` method
$orders = Order::all(['status' => 'processing', 'orderby' => 'id', 'order' => 'asc']);
```
#Product Options: https://woocommerce.github.io/woocommerce-rest-api-docs/#products
#Customer Options: https://woocommerce.github.io/woocommerce-rest-api-docs/#customers
#Order Options: https://woocommerce.github.io/woocommerce-rest-api-docs/#orders
# You can also use ```WooCommerce``` Facade
```
use Codexshaper\WooCommerce\Facades\WooCommerce;
public function products()
{
return WooCommerce::all('products');
}
public function product( Request $request )
{
$product = WooCommerce::find('products/'.$request->id);
}
public function orders()
{
return WooCommerce::all('orders');
}
public function order( Request $request )
{
$order = WooCommerce::all('orders/'.$request->id);
}
public function customers()
{
return WooCommerce::all('customers');
}
public function customer( Request $request )
{
$customer = WooCommerce::all('customers/'.$request->id);
}
```
# Use Facade Alias
```
use WooCommerce // Same as use Codexshaper\WooCommerce\Facades\WooCommerce;
use Customer // Same as use Codexshaper\WooCommerce\Models\Customer;
use Order // Same as use Codexshaper\WooCommerce\Models\Order;
use Product // Same as Codexshaper\WooCommerce\Models\Product;
```