We intend to write an article that technically outlines the way Whole Foods Market employs Symfony2 to create a scalable, available and maintainable codebase for our API. The intention is to not endorse any specific vendor, but to outline specific architectural choices we made from an application and infrastructure perspective. Since this is a technical article, we will need to support the ideas under discussion by providing code samples. Code we release will not divulge any trade secrets or compromise the security of our application in any way. All technical teams will be presented this article, in its entirety, and have the opportunity to modify, review and comment on it prior to publishing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.hostname = "symfony.vm" | |
config.vm.box = "sameg14/symfony2" | |
config.vm.network "private_network", ip: "10.10.10.24" | |
config.vm.synced_folder "symfony2", "/var/www/symfony2" | |
config.vm.provider "virtualbox" do |vb| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('vendor/autoload.php'); | |
require('config.php'); | |
$mail = new PHPMailer(); | |
$mail->IsSMTP(); | |
$mail->CharSet = 'UTF-8'; | |
$mail->Host = "smtp.gmail.com"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": { | |
"common": "Austria", | |
"official": "Republic of Austria", | |
"native": { | |
"bar": { | |
"official": "Republik Österreich", | |
"common": "Österreich" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Debug\Debug; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\ClassLoader\ApcClassLoader; | |
$env = getenv('ENVIRONMENT'); | |
if (!isset($env) || empty($env)) { | |
die('Please set environment variable in nginx like so: fastcgi_param ENVIRONMENT prod;'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name symfony.vm; | |
root /usr/share/nginx/html/web; | |
error_log /var/log/nginx/symfony.error.log; | |
access_log /var/log/nginx/symfony.access.log; | |
rewrite ^/index\.php/?(.*)$ /$1 permanent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName symfony.vm | |
ServerAlias symfony.vm | |
DocumentRoot /var/www/symfony/web | |
<Directory /var/www/symfony/web> | |
DirectoryIndex app_dev.php | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All | |
Order allow,deny |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DirectoryIndex app_dev.php | |
<IfModule mod_negotiation.c> | |
Options -MultiViews | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ | |
RewriteRule ^(.*) - [E=BASE:%1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"formatVersion": 1, | |
"passTypeIdentifier": "pass.com.accenture.wfm.affinity", | |
"serialNumber": "p69f2J", | |
"teamIdentifier": "YJ9R4XZ4CL", | |
"webServiceURL": "https://example.com/passes/", | |
"authenticationToken": "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc", | |
"locations": [ | |
{ | |
"longitude": -122.3748889, |