Silex Snippets
Sublime Text package with useful snippets for Silex, the PHP micro-framework.
Details
Installs
- Total 1K
- Win 549
- Mac 281
- Linux 273
Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Sublime-Silex
This is a Sublime Text package with useful snippets for Silex, the PHP micro-framework.
How to install
With Package Control
Run “Package Control: Install Package” command, find and install Silex Snippets
plugin.
Manually
Download git repo into your packages folder.
You can also make a clone of the repository into your packages folder:
git clone https://github.com/franciscosantamaria/sublime-silex.git silex-snippets
Shortcuts
Routing
siget
GET route.
$app->get('', function () use ($app) {
}
);
sipost
POST route.
$app->post('', function () use ($app) {
}
);
siput
PUT route.
$app->put('', function () use ($app) {
}
);
simatch
Math all methods routes (GET, POST, PUT and DELETE).
$app->match('', function () use ($app) {
}
);
sidel
DELETE route.
$app->delete('', function () use ($app) {
}
);
Middlewares
siafter
After middleware. Allows tweak the Response before it is sent to the client.
$app->after(function (Request $request, Response $response) {
}
);
sibefore
Before middleware. Allows tweak the Request before the controller is executed.
$app->before(function (Request $request) {
}
);
sifinish
Finish middleware. Allows you execute tasks after the Response has been sent.
$app->finish(function (Request $request, Response $response) {
}
);
Providers
Registering service providers
sidoctrinere
Registers DoctrineServiceProvider.
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
'db.options' => array(
'driver' => '',
'dbname' => '',
'host' => '',
'user' => '',
'password' => '',
),
));
simonologre
Registers MonologServiceProvider.
$app->register(new Silex\Provider\MonologServiceProvider(), array(
'monolog.logfile' => '',
'monolog.level' => '',
'monolog.name' => '',
)
);
siserializerre
Registers SerializerServiceProvider.
$app->register(new Silex\Provider\SerializerServiceProvider());
sisessionre
Registers SessionServiceProvider.
$app->register(new Silex\Provider\SessionServiceProvider());
simailerre
Registers SwiftmailerServiceProvider.
$app->register(new Silex\Provider\SwiftmailerServiceProvider(), array(
'swiftmailer.options' => array(
'host' => '',
'port' => '',
'username' => '',
'password' => '',
'encryption' => ,
'auth_mode' => ,
),
));
sitransre
Registers TranslationServiceProvider.
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
'locale_fallbacks' => array('en'),
));
sitwigre
Registers TwigServiceProvider.
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => '',
));
siurlgere
Registers UrlGeneratorServiceProvider.
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
sivalre
Registers ValidatorServiceProvider.
$app->register(new Silex\Provider\ValidatorServiceProvider());
Services
Service definitions
sise
Creates a new service definition.
\$app[''] = function() {
};
sisec
Creates a new service definition, with the container passed as argument.
\$app[''] = function($app) {
};
Shared services
sisha
Creates a new shared service definition.
$app[''] = $app->share(function() {
}
);
sishac
Creates a new shared service definition, with the container passed as argument.
$app[''] = $app->share(function($app) {
}
);
Protected services
sipro
Creates a new protected service definition.
$app[''] = $app->protect(function() {
}
);
Monolog
simonodebug
Creates log entry with 'debug' level.
$app['monolog']->addDebug('');
simonoerr
Creates log entry with 'error' level.
$app['monolog']->addError('');
simonoinfo
Creates log entry with 'info' level.
$app['monolog']->addInfo('');
simonowarn
Creates log entry with 'warning' level.
$app['monolog']->addWarning('');
Serializer
siserialize
Serializes data using an instance of Symfony\Component\Serializer\Serializer.
$app['serializer']->serialize(,'');
sideserialize
Deserializes data into the given type using an instance of Symfony\Component\Serializer\Serializer.
$app['serializer']->deserialize(,'','');
Session
siseget
Fetchs a value from session storage.
$app['session']->get('');
siseset
Stores a value in the session storage.
$app['session']->set('',);
Swiftmailer
simailsend
Sends a mail.
$app['mailer']->send();
Translation
sitrans
$app['translator']->trans($message,array(
'' => '',
));
Twig
sitwig
Renders a twig file.
$app['twig']->render('',array(
'' => '',
));
UrlGenerator
siurlgen
Generates URL for named route.
app['url_generator']->generate('',array('' => ''));
Contribute
If you have seen mistakes or want to add new snippets, feel free to fork the project and make any pull request you want.