https://github.com/gnikyt/basic-shopify-resource
A basic resource wrapper for Basic-Shopify-API
https://github.com/gnikyt/basic-shopify-resource
helper library resources shopify shopify-api
Last synced: 2 months ago
JSON representation
A basic resource wrapper for Basic-Shopify-API
- Host: GitHub
- URL: https://github.com/gnikyt/basic-shopify-resource
- Owner: gnikyt
- License: mit
- Created: 2018-10-14T20:40:51.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-22T03:04:11.000Z (over 7 years ago)
- Last Synced: 2025-10-06T19:44:03.541Z (8 months ago)
- Topics: helper, library, resources, shopify, shopify-api
- Language: PHP
- Size: 108 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Basic Shopify Resource
[](http://travis-ci.org/ohmybrew/Basic-Shopify-Resource)
[](https://coveralls.io/github/ohmybrew/Basic-Shopify-Resource?branch=master)
[](https://styleci.io/repos/153016975)
[](https://packagist.org/packages/ohmybrew/basic-shopify-resource)
This library is a simple wrapper for the Basic Shopify API to interact with the Shopify resources in a more friendly manner.
**Currently in the works, many models are missing**.
## Examples
```php
# Setting up a static connection
Connection::set(
true, // false for public API
'example-shop.myshopify.com',
['key' => '9798928b7bac29a732e3c1f3646732df2', 'password' => 'dd69e76588e9008b0b8ae1dd7a7b7b59']
);
```
```php
$product = Product::find(1624265326631);
echo "Product: {$product->title}";
$product->title = 'New Title';
$product->save();
echo $product->variants->first()->id;
print_r($pproduct->variants->first()->image->src); // Gets the variant image (lazy loaded)
print_r($product->variants->first()->product); // Gets product for variant (lazy loaded)
print_r($product->collections->first()->collects); // Gets collects for the collection (lazy loaded)
$count = Product::all()->count();
echo "There are {$count} products";
$variant = ProductVariant::findThrough(12999209309, $product);
echo $variant->id;
$collection = CustomCollection::find(29889201111);
echo $collection->handle;
$collect = Collect::all(['collection_id' => $collection->id]);
$products = $collect->map(function ($c) { return $c->product; });
```
## Status
14.00% completed
- [x] ProductImage
- [x] ProductVariant
- [x] CustomCollection
- [x] Collect
- [x] Product
- [x] Shop
- [x] Asset
- [x] Theme
- [ ] AccessScope
- [ ] StorefrontAccessToken
- [ ] Policy
- [ ] ShippingZone
- [ ] Province
- [ ] Country
- [ ] AbandonedCheckout
- [ ] DraftOrder
- [ ] Order
- [ ] OrderRisk
- [ ] Refund
- [ ] Transaction
- [ ] Payouts
- [ ] Balance
- [ ] Transactions
- [ ] SmartCollection
- [ ] Webhook
- [ ] Event
- [ ] CustomerAddress
- [ ] Customer
- [ ] CustomerSavedSearch
- [ ] User
- [ ] Multipass
- [ ] GiftCard
- [ ] ShopifyQL
- [ ] Report
- [ ] PriceRule
- [ ] DiscountCode
- [ ] Checkout
- [ ] ResourceFeedback
- [ ] ProductListing
- [ ] CollectionListing
- [ ] Payment
- [ ] InventoryItem
- [ ] Location
- [ ] InventoryLevel
- [ ] CarrierService
- [ ] FulfillmentEvent
- [ ] Fulfillment
- [ ] FulfillmentService
- [ ] Page
- [ ] Comment
- [ ] Blog
- [ ] Redirect
- [ ] ScriptTag
- [ ] BlogArticle
- [ ] UsageCharge
- [ ] ApplicationCredit
- [ ] ApplicationCharge
- [ ] RecurringApplicationCharge
## Testing
Run `bin/phpunit --no-coverage` for tests.
Run `bin/phpunit` for full coverage.