Skip to content

Instantly share code, notes, and snippets.

Avatar
:atom:
Data & Mathematics lover.

Leonardo Rifeli leonardorifeli

:atom:
Data & Mathematics lover.
View GitHub Profile
@leonardorifeli
leonardorifeli / Users.class.php
Created Jun 21, 2014
88bit - Classe de usuários
View Users.class.php
<?php
class Users extends DataBase {
public $id;
public $email;
public $birthDate;
public $fullName;
public $city;
public $state;
View gitcowsay.sh
git config --global alias.cowsay '!git commit -m "`fortune | cowsay -f tux`"'
@leonardorifeli
leonardorifeli / generator.php
Created Oct 15, 2015 — forked from tawfekov/generator.php
Doctrine2 Generate Entities form Existing Database
View generator.php
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@leonardorifeli
leonardorifeli / tagcloud.sh
Created Jan 17, 2016 — forked from karmi/tagcloud.sh
Simple tag cloud with ElasticSearch `terms` facet
View tagcloud.sh
# (Re)create the index
curl -X DELETE "http://localhost:9200/tagcloud"
curl -X PUT "http://localhost:9200/tagcloud"-d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'
@leonardorifeli
leonardorifeli / People.php
Last active Sep 22, 2017
Working with annotations using the doctrine annotation reader
View People.php
<?php
/**
* @PeopleAnnotation(description="Get all information about a people", type="class")
*/
class People {
/**
* @PeopleAnnotation(description="Use to people name", type="attribute")
*/
@leonardorifeli
leonardorifeli / ConnectionInformationService.php
Last active Aug 19, 2016
Implemented the Ratchet socket using PHP
View ConnectionInformationService.php
<?php
namespace Hermes\Business\Service;
use Ratchet\ConnectionInterface;
abstract class ConnectionInformationService
{
static public function checkInformations(ConnectionInterface $connection)
@leonardorifeli
leonardorifeli / Automobile.java
Last active Aug 20, 2016
Inheritance or composition article
View Automobile.java
package com.leonardorifeli.article.inheritance.model;
public class Automobile {
private String color;
private Integer quantityPort;
public String getColor() {
return color;
}
@leonardorifeli
leonardorifeli / .travis.yml
Created Nov 11, 2016
Post about structure of blog
View .travis.yml
language: ruby
rvm:
- 2.2.2
before_script:
- chmod +x build.sh
script: ./build.sh
branches:
View 1.How to easily implement a REST API with oAuth2 presentation.md

It's still a work in progress...

Intro

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.

Ok, you know the bundles

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. :

@leonardorifeli
leonardorifeli / GenerateReport.java
Last active Mar 20, 2017
SOLID - SRP - PopulationStandardDeviation
View GenerateReport.java
package com.leonardorifeli.article;
public class GenerateReport {
public ArrayList<String> find() { }
public ArrayList<String> proccess() { }
public void print() { }
}
You can’t perform that action at this time.