PHP Symfony 2.8 framework
This is a sample project which shows how to create an embedded app on Tradeshift using PHP Symfony backend, with Angular.js on frontend, utilizing Tradeshift's UI Components.
The app authenticates with Tradeshift server using OAUTH2, and retrieves current company data as an example of calling Tradeshift API.
The app needs to be run inside Tradeshift platform to fully work - see documentation here.
This sample app has multiple language supportusing English and Russian languages.
- composer
- PHP 5.6 or higher
##How to build Symfony project
- git clone https://github.com/Tradeshift/tradeshift-app-samples.git
- cd to project folder
- composer install
##Configuration
Set your own configuration in src/AppBundle/Resources/Models/SecurityModel.php
For example: CONST TRADESHIFT_CLIENT_ID = 'AppVendor.AppID'; // see Oauth2 Client ID in Tradeshift App Edit form CONST TRADESHIFT_REDIRECT_URL = 'https://your.website.com/oauth2/callback'; //should be registered at Tradeshift side CONST TRADESHIFT_CLIENT_SECRET = 'XXXX-XXXX-XXXX-XXXX-XXXXXXXX'; //generated by Tradeshift
** About 'tradeshiftAPIDomainName' URI please read Tradeshift developer documentation.
##Back-end REST API
Action | Request | URL |
---|---|---|
Check health | GET | /health |
Get locale | GET | /locale |
Get translations | GET | /locale/translations |
Company info | GET | /account/info |
Demo table | GET | /demo/grid-data |
Documents list, type Invoice | GET | /document/documents |
##Front-end ####AngularJS application see project folder : web/frontend
- By default, the app points to Tradeshift's sandbox, if you want to change it to production - change URL's in src\AppBundle\Resources\Models\SecurityModel.php
- For translation:
- see /app/Resources/translations/ for back-end storage translation
- or /web/frontend/locales/ for front-end translation (use AngularJS .useStaticFilesLoader for local storage)
https://devcenter.heroku.com/articles/getting-started-with-symfony
- Health monitoring - Go to the
https://your_app_uri.com/api/health
. If you get 200 and see payloadGood job!
that means the app is up and running.