#Install Symfony and the bundles
Create New Symfony Project
symfony new {project_name} lts
Require Bundles
composer require jms/serializer-bundle
bind\((.+?).class\).toProvider\((.)(.+?).class\).in\(com.google.inject.Singleton.class\); | |
@Singleton\n@Binds\npublic abstract $1 bind$1($2$3 \L$2\E$3); | |
bind\(new TypeLiteral<(.+?)<(.+?)>>\(\) \{\n \}\).to\((.)(.+?).class\).in\(com.google.inject.Singleton.class\); | |
@Singleton\n@Binds\npublic abstract $1<$2> bind$1$2($3$4 \L$3\E$4);\n | |
@Bind for bind(IYourInterface.clas).to(YourImplementation.class) in abstract method | |
@Provide @Singleton for bind(IYourInterface.clas).toInstance(new YourImplementation()) |
#Install Symfony and the bundles
Create New Symfony Project
symfony new {project_name} lts
Require Bundles
composer require jms/serializer-bundle
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 :
var dirTree = require('directory-tree'); | |
console.log(getCollections()); | |
function getCollections (){ | |
var tree = dirTree.directoryTree('resources/',['.json']); | |
var collections = collections || []; | |
console.log(tree.children); | |
for (var i in tree.children) { |
var request = require("request"); | |
var express = require('express'); | |
var zlib = require("zlib"); | |
var LRUCache = require('lru-native'); | |
var app = express(); | |
var cache = new LRUCache({ maxElements: 1000 }); | |
var CACHE_TIME = 1 * 60 * 1000; // bir dk | |
app.get('/doviz-kurlari', function(req, res) | |
{ |