#!/usr/bin/env bash | |
# This script sets a parameter with the git tag that was | |
# just checked out (this is a post-checkout hook). | |
# If there is no tag, the parameter is set with the current | |
# branch name + the HEAD hash. | |
# Place this file into .git/hooks/ and chmod +x it. | |
set -e | |
# This is the parameters.yml parameter to look for |
A Pen by Joseph Fusco on CodePen.
#!/bin/bash | |
sudo a2dismod php7.0 | |
sudo a2dismod php7.1 | |
sudo a2enmod php5.6 | |
sudo service apache2 restart | |
sudo ln -sfn /usr/bin/php5.6 /etc/alternatives/php |
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle
The API we are creating in this gist will follow these rules :
- The API only returns JSON responses
- All API routes require authentication
- Authentication is handled via OAuth2 with
password
Grant Type only (no need for Authorization pages and such). - API versioning is managed via a subdomain (e.g.
v1.api.example.com
)
The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :
-
Open Terminal
Ctrl+Alt+T
Download Firefox Developer Editiontar file
wget https://download.mozilla.org/?product=firefox-aurora-latest-ssl&os=linux64&lang=en-US
-
Copy tar file to
opt
sudo cp -rp firefox-35.0a2.en-US.linux-x86_64.tar.bz2
-
Open
opt
folder (cd /opt/
) and untar filesudo tar xjf firefox-35.0a2.en-US.linux-x86_64.tar.bz2
<html> | |
<style type="text/css"> | |
.team_one{ | |
fill:#FF4040; | |
} | |
.team_two{ | |
fill:#FF9640; | |
} | |
.team_three{ | |
fill:#33CCCC; |
I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:
- the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
- set the service for
oauth_user_provider
in thesecurity.yml
with your custom created service
Here are the steps:
- Routing. In
routing.yml
I have added all the routes for both bundles. - Configuration. I have set the
config.yml
mostly as it is presented in the HWIOAuthBundle. - Security. I have set the
security.yml
mostly as it is presented in the HWIOAuthBundle (though my routes are using/login
pattern, not/connect
). Also, theoauth_user_provider
is set for my custom service.
/(?<=\s|:)\(?(?:(0?[1-3]\d{1,2})\)?(?:\s|-)?)?((?:\d[\d-]{5}|15[\s\d-]{7})\d+)/ |