Skip to content

Latest commit

 

History

History

php-symfony

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Tradeshift Embedded PHP Symfony App Sample

PHP Symfony 2.8 framework

Description

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.

Requirements

  • composer
  • PHP 5.6 or higher

##How to build Symfony project

  1. git clone https://github.com/Tradeshift/tradeshift-app-samples.git
  2. cd to project folder
  3. 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

Notes

  • 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)

###Deploy Symfony to Heroku

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 payload Good job! that means the app is up and running.