First, Lets find out what version of PHP we're running (To find out if it's the default version).
To do that, Within the terminal, Fire this command:
which php
# Copyright 2014 Dan Krause | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.
You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :
javascript | |
ES6ValidationInspection | |
JSAccessibilityCheckInspection | |
JSBitwiseOperatorUsageInspection | |
JSCheckFunctionSignaturesInspection | |
JSClosureCompilerSyntaxInspection | |
JSCommentMatchesSignatureInspection | |
JSComparisonWithNaNInspection | |
JSConsecutiveCommasInArrayLiteralInspection |
The API we are creating in this gist will follow these rules :
password
Grant Type only (no need for Authorization pages and such).v1.api.example.com
)The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :
#!/bin/sh | |
# Configure homebrew permissions to allow multiple users on MAC OSX. | |
# Any user from the admin group will be able to manage the homebrew and cask installation on the machine. | |
# allow admins to manage homebrew's local install directory | |
chgrp -R admin /usr/local | |
chmod -R g+w /usr/local | |
# allow admins to homebrew's local cache of formulae and source files | |
chgrp -R admin /Library/Caches/Homebrew |
The API we are creating in this gist will follow these rules :
password
Grant Type only (no need for Authorization pages and such).v1.api.example.com
)The API will be written in PHP with the Symfony 3 framework. The following SF2 bundles are used :
const fs = require('fs'); | |
const solc = require('solc'); | |
const Web3 = require('web3'); | |
// Connect to local Ethereum node | |
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); | |
// Compile the source code | |
const input = fs.readFileSync('Token.sol'); | |
const output = solc.compile(input.toString(), 1); |