{"id":19312186,"url":"https://github.com/bigcommerce/hello-world-app-php-silex","last_synced_at":"2025-10-31T09:34:08.618Z","repository":{"id":13994022,"uuid":"16695155","full_name":"bigcommerce/hello-world-app-php-silex","owner":"bigcommerce","description":"Hello World sample app in PHP and Silex","archived":false,"fork":false,"pushed_at":"2020-12-27T10:40:38.000Z","size":29,"stargazers_count":24,"open_issues_count":7,"forks_count":56,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-04-02T00:51:22.405Z","etag":null,"topics":["bigcommerce","oauth-application","php","silex"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigcommerce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-10T12:52:04.000Z","updated_at":"2024-08-15T00:08:09.000Z","dependencies_parsed_at":"2022-07-08T03:57:37.788Z","dependency_job_id":null,"html_url":"https://github.com/bigcommerce/hello-world-app-php-silex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fhello-world-app-php-silex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fhello-world-app-php-silex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fhello-world-app-php-silex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fhello-world-app-php-silex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigcommerce","download_url":"https://codeload.github.com/bigcommerce/hello-world-app-php-silex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250267459,"owners_count":21402485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bigcommerce","oauth-application","php","silex"],"created_at":"2024-11-10T00:33:28.205Z","updated_at":"2025-10-31T09:34:03.568Z","avatar_url":"https://github.com/bigcommerce.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BigCommerce Sample App: PHP\n\nThis is a small Silex application that implements the OAuth callback flow for BigCommerce [Single Click Apps][single_click_apps]\nand uses the [BigCommerce API][api_client] to pull a list of products on a BigCommerce store. For information on how to develop apps\nfor BigCommerce stores, see our [Developer Portal][devdocs].\n\nWe hope this sample gives you a good starting point for building your next killer app! What follows are steps specific\nto running and installing this sample application.\n\n## Prerequisites\n* A web server such as MAMP or Apache. A localhost address will work fine for the hello world app.\n* PHP\n* [Composer](https://getcomposer.org/doc/00-intro.md \"Composer\")\n\n### Registering the app with BigCommerce\n1. Create a trial store on [BigCommerce](https://www.bigcommerce.com/)\n2. Go to the [Developer Portal][devportal] and log in by going to \"My Apps\"\n3. Click the button \"Create an app\", enter a name for the new app, and then click \"Create\"\n4. You don't have to fill out all the details for your app right away, but you do need\nto provide some core details in section 4 (Technical). Note that if you are just getting\nstarted, you can use `localhost` for your hostname, but ultimately you'll need to host your\napp on the public Internet.\n  * _Auth Callback URL_: `https://\u003capp hostname\u003e/bigcommerce/callback`\n  * _Load Callback URL_: `https://\u003capp hostname\u003e/bigcommerce/load`\n  * _Uninstall Callback URL_: `https://\u003capp hostname\u003e/bigcommerce/uninstall`\n  * _Remove User Callback URL_: `https://\u003capp hostname\u003e/bigcommerce/remove-user` (if enabling your app for multiple users)\n5. Enable the _Products - Read Only_ scope under _OAuth scopes_, which is what this sample app needs.\n    **Note:** If you are managing customer information through the API (such as with the _Recently Purchased Products Block_ example below) then you will need to also enable the _Customers_ scope to at least read data.\n  below) then you will need to also enable the _Customers_ scope to at least read.\n6. Click `Save \u0026 Close` on the top right of the dialog.\n7. You'll now see your app in a list in the _My Apps_ section of Developer Portal. Hover over it and click\n_View Client ID_. You'll need these values in the next step.\n\n### Getting Started\n1. Fork the repo (optional).\n2. Clone the repo.\n\n        git clone https://github.com/bigcommerce/hello-world-app-php-silex\n3. Use Composer to install the dependencies.\n\n        php composer.phar install\n4. Copy `.env-example` to `.env` and set the following environment variables in it.\n\n        BC_AUTH_SERVICE=https://login.bigcommerce.com\n        BC_CLIENT_ID=\u003ccontents of Client ID field\u003e\n        BC_CLIENT_SECRET=\u003ccontents of Client Secret field\u003e\n        BC_CALLBACK_URL=\u003cURL TO YOUR AUTH CALLBACK ENDPOINT\u003e\n4. Restart the software or the entire host as needed to set the environment variables.\n\n### Hosting the app\nIn order to install this app in a BigCommerce store, it must be hosted on the public Internet. You can get started in development and use `localhost` in your URLs, but ultimately you will need to host it somewhere to use the app anywhere other than your development system. One easy option is to put it on Heroku.\n\n#### Heroku\n_Note: It is assumed that you already have a Heroku account, have the Heroku toolbelt installed, and have authenticated with\nthe toolbelt. See [Heroku][toolbelt] for details._\n\n* Create a new Heroku app: `heroku create \u003cappname\u003e`\n* Push the project to Heroku: `git push heroku master -u`\n* Set `APP_URL` in .env to `https://\u003cappname\u003e.herokuapp.com`\n* Add the `heroku-config` plugin: `heroku plugins:install heroku-config`\n* Push the local environment variables to heroku: `heroku config:push`\n\nIn the [BigCommerce Developer Portal][devportal], you'll need to update the app's callback URLs:\n\n* _Auth Callback URL_: `https://\u003cappname\u003e.herokuapp.com/auth/callback`\n* _Load Callback URL_: `https://\u003cappname\u003e.herokuapp.com/load`\n* _Uninstall Callback URL_: `https://\u003cappname\u003e.herokuapp.com/uninstall`\n\n### Installing the app in your trial store\n* Login to your trial store\n* Go to the Marketplace and click _My Drafts_. Find the app you just created and click it.\n* A details dialog will open. Click _Install_ and the draft app will be installed in your store.\n\n## Showing the Recently Purchased Products Block with JWT\nThis example repo contains the ability to securely show recently purchased products. This is how it looks:\n\n![](http://monosnap.com/image/iuFxhuS8havstVdzNHQGjz2aDmzDwO.png)\n\n### Adding the block to your theme\n1. Edit your `Footer.html` file in blueprint or Footer Scripts if you're using Stencil and add:\n    ```javascript\n    \u003cscript\u003e\n    var appClientId = \"**BC_CLIENT_ID**\"; // TODO: Fill this in with your app's client ID.\n    var storeHash = \"**TEST_STORE_HASH**\"; // TODO: Fill this in wit the test store's store hash (found in base url before the `store-` part)\n    var appUrl = \"**APP_URL**\"; // TODO: Replace this with the URL to your app.\n\n    // Get the JWT token from the BC server signed first.\n    $.get('/customer/current.jwt?app_client_id='+appClientId, function(jwtToken) {\n      // Now that we have the JWT token, use it to get the recent purchases block.\n      $.get(appUrl+'/storefront/'+storeHash+'/customers/'+jwtToken+'/recently_purchased.html', function(htmlContent) {\n        $('#recent_purchases_block').html(htmlContent, true);\n      });\n    });\n    \u003c/script\u003e\n    ```\n2. Put `\u003cdiv id=\"recent_purchases_block\"\u003e\u003c/div\u003e` wherever you want the block to appear. If you're using blueprint it is recommended that you put it in default.html right before `%%Panel.SideTopSellers%%`.\n3. Log in as a customer in your store's frontend (or create a customer account if one doesn't exist yet), place an order then go to the section where you added the `\u003cdiv id=\"recent_purchases_block\"\u003e\u003c/div\u003e`. You should see the Recently Purchased Products block appear.\n\n\n\n[single_click_apps]: https://developer.bigcommerce.com/api/#building-oauth-apps\n[api_client]: https://github.com/bigcommerce/bigcommerce-api-php\n[devdocs]: https://developer.bigcommerce.com\n[devportal]: https://devtools.bigcommerce.com\n[toolbelt]: https://toolbelt.heroku.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigcommerce%2Fhello-world-app-php-silex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigcommerce%2Fhello-world-app-php-silex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigcommerce%2Fhello-world-app-php-silex/lists"}