In Silex, the most common way to define the controller of a route is with a
closure. But when your project gets bigger, you want to organize your code in
classes. You can use the syntax ClassName::methodName
in your route
definition instead of a function () { ... }
but you have to inject the
Silex\Application $app
as a parameter on each method of your controller
class, which can become quite boring.
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
{% extends "form_div_layout.html.twig" %} | |
{# Widgets #} | |
{% block form_widget_simple %} | |
{% spaceless %} | |
{% set type = type|default('text') %} | |
{% if attr.class is defined and not "form-control" in attr.class %} | |
{% set attr = attr|merge({class: attr.class ~ ' form-control'}) %} | |
{% elseif attr.class is not defined %} |
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 | |
/** | |
* WebTestCase client-aware test case | |
*/ | |
trait ClientAware | |
{ | |
/** | |
* @var \Symfony\Bundle\FrameworkBundle\Client | |
*/ | |
private $client; |
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
Feature: Good SEO | |
As a worried customer | |
I expect my SEO to be good | |
Scenario: My SEO is good | |
When I search for "скачать бесплатно без регистрации и смс" on "http://google.com" | |
Then my shitty website should be at least on the "4"th line |
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": "symfony/framework-standard-edition", | |
"description": "The \"Symfony Standard Edition\" distribution", | |
"autoload": { | |
"psr-0": { "": "src/" } | |
}, | |
"require": { | |
"php": ">=5.3.3", | |
"symfony/symfony": "2.2.0", |
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 | |
/** | |
* @Route("/users") | |
* @UseEntities({"users": "My\Bundle\Entity\User"}) | |
*/ | |
class UsersController extends Controller | |
{ | |
/** | |
* @Route("/show", name="front_users_show") |
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
set :application, "AppName" | |
set :repository, "[email protected]:path/toRepo.git" | |
set :deploy_to, "/app/appname" | |
set :deploy_via, :copy | |
set :stage_dir, "config/stages" | |
set :current_dir , "www" | |
set :default_stage, "dev" | |
set :stages, %w(dev testing prod) | |
set :use_sudo, false |
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
# tasks for dumping your production db | |
set :domain, "example.com" | |
set :user, "deploy" | |
set :database_username, "root" | |
set :database_password, "" | |
namespace :db_dumper do | |
desc "Exports the production db to the home directory of user" | |
task :mysql_dump, :roles => [:db], :only => { :primary => true } do |
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
http://www.dizzy.co.uk/cheatsheets | |
This work is licensed under the Creative Commons | |
Attribution-NonCommercial-NoDerivs 2.0 License. To | |
view a copy of this license, visit | |
http://creativecommons.org/licenses/by-nc-nd/2.0/uk | |
########## Shell Commands ########## | |
Installation: | |
$ gem install capistrano |
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
#box { | |
padding: 30px 45px; | |
color: black; | |
background-color: white; | |
width: 960px; | |
line-height: 1.4; | |
-webkit-box-shadow: 0px 0 53px rgba(0, 0, 0, 1), 2px 0 5px rgba(0, 0, 0, 1); | |
} |