Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/richtermeister/symfony-shopify-bundle
Makes Shopify app development easier, quicker, stronger.
https://github.com/richtermeister/symfony-shopify-bundle
php shopify symfony
Last synced: about 4 hours ago
JSON representation
Makes Shopify app development easier, quicker, stronger.
- Host: GitHub
- URL: https://github.com/richtermeister/symfony-shopify-bundle
- Owner: Richtermeister
- License: mit
- Created: 2015-04-07T14:58:36.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-12-06T04:57:42.000Z (about 1 year ago)
- Last Synced: 2024-12-17T16:44:46.043Z (about 1 month ago)
- Topics: php, shopify, symfony
- Language: PHP
- Size: 199 KB
- Stars: 28
- Watchers: 9
- Forks: 28
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Symfony Shopify Bundle
This bundle enables quick and easy integration with Shopify.
[![Build Status on Travis](https://img.shields.io/travis/Richtermeister/symfony-shopify-bundle/master.svg)](http://travis-ci.org/Richtermeister/symfony-shopify-bundle)
[![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/Richtermeister/symfony-shopify-bundle.svg)](https://scrutinizer-ci.com/g/Richtermeister/symfony-shopify-bundle/)## Features
* Shopify OAuth signup flow with a few configuration options.
* Thin wrapper around Guzzle for easy API interactions. All API endpoints are supported.
* Symfony firewall to verify incoming API requests are authenticated (to embed app in Shopify Admin)
* Webhook support to listen for Shopify events.## The Store Model
Stores are represented by instances of `ShopifyStoreInterface`. It is up to you to provide an implementation of it and handle persistence.
## OAUTH Configuration
``` yml
// app/confiy.ymlcode_cloud_shopify:
store_manager_id: { id of your store manager service }
oauth:
api_key: { your app's API Key }
shared_secret: { your app's shared secret }
scope: { the scopes your app requires, i.e.: "read_customers,write_customers" }
redirect_route: { the route to redirect users to after installing the app, i.e.: "admin_dashboard".. }
webhooks:
- orders/create
- customers/update
```## API Usage
You can access the API of an authorized store via the `` service:
``` php
// in Controller$api = $this->get('')->getForStore("name-of-store");
$customers = $api->Customer->findAll();
$orders = $api->Order->findAll();
```## Webhooks
You can register a list of webhooks you are interested in receiving.
The bundle will automatically register them with Shopify and dispatch an event every time a webhook is received.```php
'onWebhook',
];
}public function onWebhook(WebhookEvent $event)
{
switch ($event->getTopic()) {
case 'orders/create':
// your custom logic here
break;
case 'orders/update':
// your custom logic here
break;
}
}
}```
## Security & Authentication
By default, the bundle provides session-based authentication for admin areas embedded within Shopify.
```yaml
security:
providers:
codecloud_shopify:
id: codecloud_shopify.security.admin_user_providerfirewalls:
admin:
pattern: ^/admin
provider: codecloud_shopify
guard:
authenticators:
- codecloud_shopify.security.session_authenticator
```Authenticated users will be an instance of `CodeCloud\Bundle\ShopifyBundle\Security\ShopifyAdminUser`,
their username will be the name of the authenticated store (storename.myshopify.com), and their roles will include `ROLE_SHOPIFY_ADMIN`.For development purposes, you can impersonate any existing store.
```yaml
# in config_dev.yml
code_cloud_shopify:
dev_impersonate_store: "{store-name}.myshopify.com"
```## Credits
Many thanks to [David Smith](http://code-cloud.uk) for originally creating this bundle.