Created
July 3, 2012 00:15
-
-
Save filhodanuvem/3036556 to your computer and use it in GitHub Desktop.
FaceApp scaffold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name" : "NomeDoProjeto", | |
"autoload" : { | |
"psr-0" : { "NomeDoProjeto" : "src/"} | |
}, | |
"minimum-stability": "dev" , | |
"license" : "MIT", | |
"authors": [ | |
{ | |
"name": "Claudson Oliveira", | |
"email": "claudsonweb@gmail.com" | |
} | |
], | |
"require": { | |
"php" : ">=5.3.4", | |
"silex/silex" : "*", | |
"respect/relational": "0.4.4", | |
"twig/twig": "1.6.0", | |
"facebook/php-sdk" : "*", | |
"swiftmailer/swiftmailer": ">=4.1.2,<4.2-dev" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__.'/vendor/autoload.php'; | |
session_start(); | |
define('ENV_DEV',0); | |
define('ENV_PROD',2); | |
define('SITE_BASE','http://'.$_SERVER['HTTP_HOST']); | |
// generals config | |
if(preg_match('/127.0.0.[0-9]+/',$_SERVER['SERVER_ADDR'])){ | |
error_reporting(E_ALL); | |
define('ENV',ENV_DEV); | |
define('APP_ID',''); | |
define('SECRET',''); | |
define('DB_USER',''); | |
define('DB_PASS',''); | |
define('DB_PATH',''); | |
}else{ | |
define('ENV',ENV_PROD); | |
error_reporting(0); | |
define('APP_ID',''); | |
define('SECRET',''); | |
define('DB_USER',''); | |
define('DB_PASS',''); | |
define('DB_PATH',''); | |
} | |
// mailer | |
define('MAIL_HOST','smtp.gmail.com'); | |
define('MAIL_PORT','465'); | |
define('MAIL_USER',''); | |
define('MAIL_PASS',''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Árvore de diretórios: | |
- cache/ | |
- public/ | |
- css/ | |
- bootstrap.min.css | |
- style.css | |
- js/ | |
- jquery-1.7.2.min.js | |
- bootstrap.min.js | |
- templates/ | |
- layout.html | |
- src/ | |
- uploads/ | |
- composer.json | |
- config.php | |
- index.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Claudson Oliveira | |
* @since 2012/09/01 | |
* Padrão de projeto para criar aplicativos | |
* no facebook usando silex como controlador, | |
* respect relational pra persistencia do modelo | |
* e twig pra view | |
* | |
*/ | |
require 'config.php'; | |
use Silex\Application; | |
use Respect\Relational\Mapper; | |
use Respect\Relational\Sql; | |
use Respect\Relational\Db; | |
$face = new Facebook(array( | |
'appId' => APP_ID, | |
'secret' => SECRET, | |
'fileUpload' => true | |
)); | |
$app = new Application; | |
$app['http'] = SITE_BASE; | |
$app['debug'] = (ENV_DEV == ENV); | |
$app->register(new Silex\Provider\TwigServiceProvider(), array( | |
'twig.path' => __DIR__ . '/templates', | |
'twig.cache' => __DIR__.'/cache', | |
)); | |
$app->register(new Silex\Provider\SwiftmailerServiceProvider(),array( | |
'swiftmailer.options' => array( | |
'host' => MAIL_HOST, | |
'username' => MAIL_USER, | |
'password' => MAIL_PASS, | |
'port' => MAIL_PORT, | |
'encryption' => 'ssl' | |
), | |
)); | |
$app->get('/',function() use ($app){ | |
return $app['twig']->render('layout.html'); | |
}); | |
$app->run(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment