Commit 1dcc05dd authored by Fabien Potencier's avatar Fabien Potencier

deprecated the phar

parent fc44ff24
......@@ -3,7 +3,7 @@
require_once __DIR__.'/vendor/autoload.php';
use Silex\Compiler;
use Silex\Compiler\Util;
$compiler = new Compiler();
$compiler->compile();
......@@ -14,3 +14,4 @@ Silex
contributing
providers/index
changelog
phar
......@@ -22,7 +22,7 @@ step.
**Let's go!**::
require_once __DIR__.'/silex.phar';
require_once __DIR__.'/vendor/autoload.php';
$app = new Silex\Application();
......@@ -32,8 +32,8 @@ step.
$app->run();
All that is needed to get access to the Framework is to include
``silex.phar``. This phar (PHP Archive) file will take care of the rest.
All that is needed to get access to the Framework is to include the
autoloader.
Next we define a route to ``/hello/{name}`` that matches for ``GET``
requests. When the route matches, the function is executed and the return
......@@ -42,7 +42,7 @@ value is sent back to the client.
Finally, the app is run. Visit ``/hello/world`` to see the result.
It's really that easy!
Installing Silex is as easy as it can get. Download the `silex.phar`_ file
and you're done!
Installing Silex is as easy as it can get. Download the `silex.zip`_ file,
unzip it, and you're done!
.. _silex.phar: http://silex.sensiolabs.org/get/silex.phar
.. _silex.zip: http://silex.sensiolabs.org/get/silex.zip
Phar File
---------
.. caution::
Using the Silex ``phar`` file is deprecated. You should use Composer
instead to install Silex and its dependencies or download one of the
archives.
Console
~~~~~~~
Silex includes a lightweight console for updating to the latest version.
To find out which version of Silex you are using, invoke ``silex.phar`` on the
command-line with ``version`` as an argument:
.. code-block:: text
$ php silex.phar version
Silex version 0a243d3 2011-04-17 14:49:31 +0200
To check that your are using the latest version, run the ``check`` command:
.. code-block:: text
$ php silex.phar check
To update ``silex.phar`` to the latest version, invoke the ``update``
command:
.. code-block:: text
$ php silex.phar update
This will automatically download a new ``silex.phar`` from
``silex.sensiolabs.org`` and replace the existing one.
Pitfalls
~~~~~~~~
There are some things that can go wrong. Here we will try and outline the
most frequent ones.
PHP configuration
~~~~~~~~~~~~~~~~~
Certain PHP distributions have restrictive default Phar settings. Setting
the following may help.
.. code-block:: ini
detect_unicode = Off
phar.readonly = Off
phar.require_hash = Off
If you are on Suhosin you will also have to set this:
.. code-block:: ini
suhosin.executor.include.whitelist = phar
.. note::
Ubuntu's PHP ships with Suhosin, so if you are using Ubuntu, you will need
this change.
Phar-Stub bug
~~~~~~~~~~~~~
Some PHP installations have a bug that throws a ``PharException`` when trying
to include the Phar. It will also tell you that ``Silex\Application`` could not
be found. A workaround is using the following include line::
require_once 'phar://'.__DIR__.'/silex.phar/autoload.php';
The exact cause of this issue could not be determined yet.
ioncube loader bug
~~~~~~~~~~~~~~~~~~
Ioncube loader is an extension that can decode PHP encoded file.
Unfortunately, old versions (prior to version 4.0.9) are not working well
with phar archives.
You must either upgrade Ioncube loader to version 4.0.9 or newer or disable it
by commenting or removing this line in your php.ini file:
.. code-block:: ini
zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so
......@@ -60,8 +60,8 @@ Registering
.. note::
Doctrine does not come with the ``silex.zip`, so you need to add Doctrine
DBAL as a dependency to your ``composer.json`` file:
Doctrine does not come with the ``silex`` archives, so you need to add
Doctrine DBAL as a dependency to your ``composer.json`` file:
.. code-block:: json
......
......@@ -48,8 +48,8 @@ Registering
.. note::
Monolog does not come with the ``silex.zip`, so you need to add it as a
dependency to your ``composer.json`` file:
Monolog does not come with the ``silex`` archives, so you need to add it
as a dependency to your ``composer.json`` file:
.. code-block:: json
......
......@@ -23,6 +23,9 @@ Parameters
* **encryption**: SMTP encryption, defaults to null.
* **auth_mode**: SMTP authentication mode, defaults to null.
* **swiftmailer.class_path** (optional): Path to where the Swift Mailer
library is located.
Services
--------
......@@ -54,12 +57,14 @@ Registering
.. code-block:: php
$app->register(new Silex\Provider\SwiftmailerServiceProvider());
$app->register(new Silex\Provider\SwiftmailerServiceProvider(), array(
'swiftmailer.class_path' => __DIR__.'/vendor/swiftmailer/swiftmailer/lib/classes',
));
.. note::
SwiftMailer does not come with the ``silex.zip`, so you need to add it as
a dependency to your ``composer.json`` file:
SwiftMailer does not come with the ``silex`` archives, so you need to add
it as a dependency to your ``composer.json`` file:
.. code-block:: json
......
......@@ -42,8 +42,9 @@ Registering
.. note::
The Symfony Translation component does not come with the ``silex.zip`, so
you need to add it as a dependency to your ``composer.json`` file:
The Symfony Translation component does not come with the ``silex``
archives, so you need to add it as a dependency to your ``composer.json``
file:
.. code-block:: json
......
......@@ -44,7 +44,7 @@ Registering
.. note::
Twig does not come with the ``silex.zip`, so you need to add it as a
Twig does not come with the ``silex`` archives, so you need to add it as a
dependency to your ``composer.json`` file:
.. code-block:: json
......
......@@ -37,8 +37,8 @@ Registering
.. note::
The Symfony Validator component does not come with the ``silex.zip`, so
you need to add it as a dependency to your ``composer.json`` file:
The Symfony Validator component does not come with the ``silex`` archives,
so you need to add it as a dependency to your ``composer.json`` file:
.. code-block:: json
......
......@@ -6,11 +6,11 @@ This chapter describes how to use Silex.
Bootstrap
---------
To include the Silex all you need to do is require the ``silex.phar``
file and create an instance of ``Silex\Application``. After your
controller definitions, call the ``run`` method on your application::
To bootstrap Silex, all you need to do is require the ``vendor/autoload.php``
file and create an instance of ``Silex\Application``. After your controller
definitions, call the ``run`` method on your application::
require_once __DIR__.'/silex.phar';
require_once __DIR__.'/vendor/autoload.php';
$app = new Silex\Application();
......@@ -718,89 +718,6 @@ correctly, to prevent Cross-Site-Scripting attacks.
return $app->json(array('name' => $name));
});
Console
-------
Silex includes a lightweight console for updating to the latest
version.
To find out which version of Silex you are using, invoke ``silex.phar`` on the
command-line with ``version`` as an argument:
.. code-block:: text
$ php silex.phar version
Silex version 0a243d3 2011-04-17 14:49:31 +0200
To check that your are using the latest version, run the ``check`` command:
.. code-block:: text
$ php silex.phar check
To update ``silex.phar`` to the latest version, invoke the ``update``
command:
.. code-block:: text
$ php silex.phar update
This will automatically download a new ``silex.phar`` from
``silex.sensiolabs.org`` and replace the existing one.
Pitfalls
--------
There are some things that can go wrong. Here we will try and outline the
most frequent ones.
PHP configuration
~~~~~~~~~~~~~~~~~
Certain PHP distributions have restrictive default Phar settings. Setting
the following may help.
.. code-block:: ini
detect_unicode = Off
phar.readonly = Off
phar.require_hash = Off
If you are on Suhosin you will also have to set this:
.. code-block:: ini
suhosin.executor.include.whitelist = phar
.. note::
Ubuntu's PHP ships with Suhosin, so if you are using Ubuntu, you will need
this change.
Phar-Stub bug
~~~~~~~~~~~~~
Some PHP installations have a bug that throws a ``PharException`` when trying
to include the Phar. It will also tell you that ``Silex\Application`` could not
be found. A workaround is using the following include line::
require_once 'phar://'.__DIR__.'/silex.phar/autoload.php';
The exact cause of this issue could not be determined yet.
ioncube loader bug
~~~~~~~~~~~~~~~~~~
Ioncube loader is an extension that can decode PHP encoded file.
Unfortunately, old versions (prior to version 4.0.9) are not working well
with phar archives.
You must either upgrade Ioncube loader to version 4.0.9 or newer or disable it
by commenting or removing this line in your php.ini file:
.. code-block:: ini
zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so
Apache configuration
--------------------
......
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
#RewriteBase /path/to/app
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
......@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Silex;
namespace Silex\Util;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpKernel\Kernel;
......@@ -18,6 +18,8 @@ use Symfony\Component\Process\Process;
/**
* The Compiler class compiles the Silex framework.
*
* This is deprecated. Use composer instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class Compiler
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment