Skip to content

Instantly share code, notes, and snippets.

@sameg14
sameg14 / VagrantFile
Last active March 1, 2018 15:55
vagrant file for symfony.vm
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|
<?php
require('vendor/autoload.php');
require('config.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "smtp.gmail.com";
{
"name": {
"common": "Austria",
"official": "Republic of Austria",
"native": {
"bar": {
"official": "Republik Österreich",
"common": "Österreich"
}
}
@sameg14
sameg14 / index.php
Created August 13, 2015 19:45
Symfony index.php front controller switches on ENVIRONMENT
<?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;');
}
@sameg14
sameg14 / nginx_vhost.conf
Created August 13, 2015 19:44
Symfony vhost nginx config with index.php as the front controller entry point
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;
@sameg14
sameg14 / apache_vhost.conf
Created August 13, 2015 19:41
Apache symfony virtualhost config
<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
@sameg14
sameg14 / .htaccess
Created August 13, 2015 19:40
Symfony app_dev.php htaccess file
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]
@sameg14
sameg14 / passbook_json_data.json
Created June 16, 2015 19:20
Test passbook json data
{
"formatVersion": 1,
"passTypeIdentifier": "pass.com.accenture.wfm.affinity",
"serialNumber": "p69f2J",
"teamIdentifier": "YJ9R4XZ4CL",
"webServiceURL": "https://example.com/passes/",
"authenticationToken": "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc",
"locations": [
{
"longitude": -122.3748889,
@sameg14
sameg14 / 7815696ecbf1c96e6894b779456d330e.md
Last active August 29, 2015 14:21
7815696ecbf1c96e6894b779456d330e

Switching an API from node using express to PHP using Symfony

Preamble

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.