Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Commit

Permalink
feature #947 Move master to 2.0 (fabpot, jkazimir)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.2.x-dev branch.

Discussion
----------

Move master to 2.0

This PR moves master to 2.0@dev. As there is a 1.2 branch, that should not be a problem for anyone ... except if you target dev-master in your composer.json, but hey, that's your choice.

Of course, it's not finished yet, but working on master is easier for everyone and future PRs.

TODO:

 - [ ] update documentation
 - [ ] update CHANGELOG

Commits
-------

5a4b265 upgraded to Pimple 2.1
322dbb5 updated route_factory service to use Pimple 2 factory method
fc8bbb6 switched to Pimple 2.0
c2421fa removed the flush call in the url generator service
5f9716d made the logger optional in all providers
349dcf9 moved everything related to the routing to a reusable service provider
e96f9be removed the request service in favor of the request_stack one
26e8543 changed charset to have a sensible default in all providers
34524a5 changed debug to have a sensible default in all providers
18b6050 fixed stupid typo...
0d10e89 fixed composer.json paths
a4b0b20 simplified composer names
6863b9a fixed composer.json files
67802eb added composer.json for Api and Provider
c341ca1 moved classes so that Silex\Provider can be used as a sub-tree split independently of eveything else
2d3a96b changed type-hint to Pimple whenever possible
df568cb added BootableProviderInterface
1ba15a1 moved the provider interfaces under Silex\Api
eb5079b moved fake routes for the security service provider to a connect() method (with auto-registration)
3fdfa4b emptied the boot() method of the remember me service provider
27eb526 moved Swiftmailer finish call to a proper listener
7bee6bf adding a new interface for providers willing to register event listeners
613c4bf removed obsolete comment
3b1ba69 removed conditions about the request stack as Symfony 2.4+ is required now
cd044b6 removed the deprecated Compiler class and the doc on the phar
de674e6 removed deprecated locale_fallback setting
24bce51 removed the deprecated TwigCoreExtension class
a4c7c51 fixed visibility
38c84ad moved locale management to a locale service provider
88e44ea refactored session code to make it more reusable
9a32c0a bumped version to 2.0
  • Loading branch information
fabpot committed May 1, 2014
2 parents d0b2b9b + 5a4b265 commit ae8f9d4
Show file tree
Hide file tree
Showing 77 changed files with 904 additions and 1,125 deletions.
9 changes: 0 additions & 9 deletions bin/compile

This file was deleted.

56 changes: 30 additions & 26 deletions composer.json
Expand Up @@ -17,47 +17,51 @@
],
"require": {
"php": ">=5.3.3",
"pimple/pimple": "~1.0",
"symfony/event-dispatcher": ">=2.3,<2.6-dev",
"symfony/http-foundation": ">=2.3,<2.6-dev",
"symfony/http-kernel": ">=2.3,<2.6-dev",
"symfony/routing": ">=2.3,<2.6-dev"
"pimple/pimple": "~2.1@dev",
"symfony/event-dispatcher": ">=2.4,<2.6-dev",
"symfony/http-foundation": ">=2.4,<2.6-dev",
"symfony/http-kernel": ">=2.4,<2.6-dev",
"symfony/routing": ">=2.4,<2.6-dev"
},
"require-dev": {
"symfony/security": ">=2.3,<2.6-dev",
"symfony/config": ">=2.3,<2.6-dev",
"symfony/locale": ">=2.3,<2.6-dev",
"symfony/form": ">=2.3,<2.6-dev",
"symfony/browser-kit": ">=2.3,<2.6-dev",
"symfony/css-selector": ">=2.3,<2.6-dev",
"symfony/debug": ">=2.3,<2.6-dev",
"symfony/dom-crawler": ">=2.3,<2.6-dev",
"symfony/finder": ">=2.3,<2.6-dev",
"symfony/monolog-bridge": ">=2.3,<2.6-dev",
"symfony/options-resolver": ">=2.3,<2.6-dev",
"symfony/process": ">=2.3,<2.6-dev",
"symfony/serializer": ">=2.3,<2.6-dev",
"symfony/translation": ">=2.3,<2.6-dev",
"symfony/twig-bridge": ">=2.3,<2.6-dev",
"symfony/validator": ">=2.3,<2.6-dev",
"symfony/security": ">=2.4,<2.6-dev",
"symfony/config": ">=2.4,<2.6-dev",
"symfony/locale": ">=2.4,<2.6-dev",
"symfony/form": ">=2.4,<2.6-dev",
"symfony/browser-kit": ">=2.4,<2.6-dev",
"symfony/css-selector": ">=2.4,<2.6-dev",
"symfony/debug": ">=2.4,<2.6-dev",
"symfony/dom-crawler": ">=2.4,<2.6-dev",
"symfony/finder": ">=2.4,<2.6-dev",
"symfony/monolog-bridge": ">=2.4,<2.6-dev",
"symfony/options-resolver": ">=2.4,<2.6-dev",
"symfony/process": ">=2.4,<2.6-dev",
"symfony/serializer": ">=2.4,<2.6-dev",
"symfony/translation": ">=2.4,<2.6-dev",
"symfony/twig-bridge": ">=2.4,<2.6-dev",
"symfony/validator": ">=2.4,<2.6-dev",
"twig/twig": ">=1.8.0,<2.0-dev",
"doctrine/dbal": "~2.2",
"swiftmailer/swiftmailer": "5.*",
"monolog/monolog": "~1.4,>=1.4.1",
"phpunit/phpunit": "~3.7"
},
"suggest": {
"symfony/browser-kit": ">=2.3,<2.6-dev",
"symfony/css-selector": ">=2.3,<2.6-dev",
"symfony/dom-crawler": ">=2.3,<2.6-dev",
"symfony/form": ">=2.3,<2.6-dev"
"symfony/browser-kit": ">=2.4,<2.6-dev",
"symfony/css-selector": ">=2.4,<2.6-dev",
"symfony/dom-crawler": ">=2.4,<2.6-dev",
"symfony/form": ">=2.4,<2.6-dev"
},
"replace": {
"silex/api": "self.version",
"silex/providers": "self.version"
},
"autoload": {
"psr-0": { "Silex": "src/" }
},
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
"dev-master": "2.0.x-dev"
}
}
}
8 changes: 8 additions & 0 deletions doc/changelog.rst
@@ -1,6 +1,14 @@
Changelog
=========

2.0.0 (2013-XX-XX)
------------------

* Updated Pimple to 2.1
* Updated session listeners to extends HttpKernel ones
* [BC BREAK] Locale management has been moved to LocaleServiceProvider which must be registered
if you want Silex to manage your locale (must also be registered for the translation service provider)

1.2.0 (2014-03-29)
------------------

Expand Down
8 changes: 4 additions & 4 deletions doc/cookbook/assets.rst
Expand Up @@ -34,11 +34,11 @@ Using it in a template is as easy as before:
If you need to implement some logic independently of the asset, define a
service instead::

$app['asset_path'] = $app->share(function () {
$app['asset_path'] = function () {
// implement whatever logic you need to determine the asset path

return 'http://assets.examples.com';
});
};

Usage is exactly the same as before:

Expand All @@ -49,15 +49,15 @@ Usage is exactly the same as before:
If the asset location depends on the asset type or path, you will need more
abstraction; here is one way to do that with a Twig function::

$app['twig'] = $app->share($app->extend('twig', function($twig, $app) {
$app->extend('twig', function($twig, $app) {
$twig->addFunction(new \Twig_SimpleFunction('asset', function ($asset) {
// implement whatever logic you need to determine the asset path

return sprintf('http://assets.examples.com/%s', ltrim($asset, '/'));
}));

return $twig;
}));
});

The ``asset`` function can then be used in your templates:

Expand Down
14 changes: 6 additions & 8 deletions doc/cookbook/multiple_loggers.rst
Expand Up @@ -18,9 +18,9 @@ using the bundled handler, but each with a different channel.
});
foreach (array('auth', 'payments', 'stats') as $channel) {
$app['monolog.'.$channel] = $app->share(function ($app) use ($channel) {
$app['monolog.'.$channel] = function ($app) use ($channel) {
return $app['monolog.factory']($channel);
});
};
}
As your application grows, or your logging needs for certain areas of the
Expand All @@ -31,13 +31,13 @@ particular service separately, including your customizations.
use Monolog\Handler\StreamHandler;
$app['monolog.payments'] = $app->share(function ($app) {
$app['monolog.payments'] = function ($app) {
$log = new $app['monolog.logger.class']('payments');
$handler = new StreamHandler($app['monolog.payments.logfile'], $app['monolog.payment.level']);
$log->pushHandler($handler);
return $log;
});
};
Alternatively, you could attempt to make the factory more complicated, and rely
on some conventions, such as checking for an array of handlers registered with
Expand All @@ -62,10 +62,8 @@ the container with the channel name, defaulting to the bundled handler.
return $log;
});
$app['monolog.payments.handlers'] = $app->share(function ($app) {
$app['monolog.payments.handlers'] = function ($app) {
return array(
new StreamHandler(__DIR__.'/../payments.log', Logger::DEBUG),
);
});
};
12 changes: 6 additions & 6 deletions doc/cookbook/session_storage.rst
Expand Up @@ -35,21 +35,21 @@ With a dedicated PDO service
'db_time_col' => 'session_time',
);
$app['pdo'] = $app->share(function () use ($app) {
$app['pdo'] = function () use ($app) {
return new PDO(
$app['pdo.dsn'],
$app['pdo.user'],
$app['pdo.password']
);
});
};
$app['session.storage.handler'] = $app->share(function () use ($app) {
$app['session.storage.handler'] = function () use ($app) {
return new PdoSessionHandler(
$app['pdo'],
$app['session.db_options'],
$app['session.storage.options']
);
});
};
Using the DoctrineServiceProvider
---------------------------------
Expand All @@ -70,13 +70,13 @@ have to make another database connection, simply pass the getWrappedConnection m
'db_time_col' => 'session_time',
);
$app['session.storage.handler'] = $app->share(function () use ($app) {
$app['session.storage.handler'] = function () use ($app) {
return new PdoSessionHandler(
$app['db']->getWrappedConnection(),
$app['session.db_options'],
$app['session.storage.options']
);
});
};
Database structure
------------------
Expand Down
1 change: 0 additions & 1 deletion doc/index.rst
Expand Up @@ -17,4 +17,3 @@ Silex
providers/index
web_servers
changelog
phar
109 changes: 0 additions & 109 deletions doc/phar.rst

This file was deleted.

8 changes: 4 additions & 4 deletions doc/providers.rst
Expand Up @@ -80,7 +80,7 @@ You are encouraged to share yours.
Creating a provider
~~~~~~~~~~~~~~~~~~~

Providers must implement the ``Silex\ServiceProviderInterface``::
Providers must implement the ``Silex\Api\ServiceProviderInterface``::

interface ServiceProviderInterface
{
Expand All @@ -100,7 +100,7 @@ Here is an example of such a provider::
namespace Acme;

use Silex\Application;
use Silex\ServiceProviderInterface;
use Silex\Api\ServiceProviderInterface;

class HelloServiceProvider implements ServiceProviderInterface
{
Expand Down Expand Up @@ -161,7 +161,7 @@ All controllers defined by the provider will now be available under the
Creating a provider
~~~~~~~~~~~~~~~~~~~

Providers must implement the ``Silex\ControllerProviderInterface``::
Providers must implement the ``Silex\Api\ControllerProviderInterface``::

interface ControllerProviderInterface
{
Expand All @@ -173,7 +173,7 @@ Here is an example of such a provider::
namespace Acme;

use Silex\Application;
use Silex\ControllerProviderInterface;
use Silex\Api\ControllerProviderInterface;

class HelloControllerProvider implements ControllerProviderInterface
{
Expand Down

0 comments on commit ae8f9d4

Please sign in to comment.