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

deprecated the phar

parent fc44ff24
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require_once __DIR__.'/vendor/autoload.php'; require_once __DIR__.'/vendor/autoload.php';
use Silex\Compiler; use Silex\Compiler\Util;
$compiler = new Compiler(); $compiler = new Compiler();
$compiler->compile(); $compiler->compile();
...@@ -13,4 +13,5 @@ Silex ...@@ -13,4 +13,5 @@ Silex
internals internals
contributing contributing
providers/index providers/index
changelog changelog
\ No newline at end of file phar
...@@ -22,7 +22,7 @@ step. ...@@ -22,7 +22,7 @@ step.
**Let's go!**:: **Let's go!**::
require_once __DIR__.'/silex.phar'; require_once __DIR__.'/vendor/autoload.php';
$app = new Silex\Application(); $app = new Silex\Application();
...@@ -32,8 +32,8 @@ step. ...@@ -32,8 +32,8 @@ step.
$app->run(); $app->run();
All that is needed to get access to the Framework is to include All that is needed to get access to the Framework is to include the
``silex.phar``. This phar (PHP Archive) file will take care of the rest. autoloader.
Next we define a route to ``/hello/{name}`` that matches for ``GET`` Next we define a route to ``/hello/{name}`` that matches for ``GET``
requests. When the route matches, the function is executed and the return requests. When the route matches, the function is executed and the return
...@@ -42,7 +42,7 @@ value is sent back to the client. ...@@ -42,7 +42,7 @@ value is sent back to the client.
Finally, the app is run. Visit ``/hello/world`` to see the result. Finally, the app is run. Visit ``/hello/world`` to see the result.
It's really that easy! It's really that easy!
Installing Silex is as easy as it can get. Download the `silex.phar`_ file Installing Silex is as easy as it can get. Download the `silex.zip`_ file,
and you're done! 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 ...@@ -60,8 +60,8 @@ Registering
.. note:: .. note::
Doctrine does not come with the ``silex.zip`, so you need to add Doctrine Doctrine does not come with the ``silex`` archives, so you need to add
DBAL as a dependency to your ``composer.json`` file: Doctrine DBAL as a dependency to your ``composer.json`` file:
.. code-block:: json .. code-block:: json
......
...@@ -48,8 +48,8 @@ Registering ...@@ -48,8 +48,8 @@ Registering
.. note:: .. note::
Monolog does not come with the ``silex.zip`, so you need to add it as a Monolog does not come with the ``silex`` archives, so you need to add it
dependency to your ``composer.json`` file: as a dependency to your ``composer.json`` file:
.. code-block:: json .. code-block:: json
......
...@@ -23,6 +23,9 @@ Parameters ...@@ -23,6 +23,9 @@ Parameters
* **encryption**: SMTP encryption, defaults to null. * **encryption**: SMTP encryption, defaults to null.
* **auth_mode**: SMTP authentication mode, 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 Services
-------- --------
...@@ -54,12 +57,14 @@ Registering ...@@ -54,12 +57,14 @@ Registering
.. code-block:: php .. 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:: .. note::
SwiftMailer does not come with the ``silex.zip`, so you need to add it as SwiftMailer does not come with the ``silex`` archives, so you need to add
a dependency to your ``composer.json`` file: it as a dependency to your ``composer.json`` file:
.. code-block:: json .. code-block:: json
......
...@@ -42,8 +42,9 @@ Registering ...@@ -42,8 +42,9 @@ Registering
.. note:: .. note::
The Symfony Translation component does not come with the ``silex.zip`, so The Symfony Translation component does not come with the ``silex``
you need to add it as a dependency to your ``composer.json`` file: archives, so you need to add it as a dependency to your ``composer.json``
file:
.. code-block:: json .. code-block:: json
......
...@@ -44,7 +44,7 @@ Registering ...@@ -44,7 +44,7 @@ Registering
.. note:: .. 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: dependency to your ``composer.json`` file:
.. code-block:: json .. code-block:: json
......
...@@ -37,8 +37,8 @@ Registering ...@@ -37,8 +37,8 @@ Registering
.. note:: .. note::
The Symfony Validator component does not come with the ``silex.zip`, so The Symfony Validator component does not come with the ``silex`` archives,
you need to add it as a dependency to your ``composer.json`` file: so you need to add it as a dependency to your ``composer.json`` file:
.. code-block:: json .. code-block:: json
......
...@@ -6,11 +6,11 @@ This chapter describes how to use Silex. ...@@ -6,11 +6,11 @@ This chapter describes how to use Silex.
Bootstrap Bootstrap
--------- ---------
To include the Silex all you need to do is require the ``silex.phar`` To bootstrap Silex, all you need to do is require the ``vendor/autoload.php``
file and create an instance of ``Silex\Application``. After your file and create an instance of ``Silex\Application``. After your controller
controller definitions, call the ``run`` method on your application:: definitions, call the ``run`` method on your application::
require_once __DIR__.'/silex.phar'; require_once __DIR__.'/vendor/autoload.php';
$app = new Silex\Application(); $app = new Silex\Application();
...@@ -718,89 +718,6 @@ correctly, to prevent Cross-Site-Scripting attacks. ...@@ -718,89 +718,6 @@ correctly, to prevent Cross-Site-Scripting attacks.
return $app->json(array('name' => $name)); 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 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 @@ ...@@ -9,7 +9,7 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Silex; namespace Silex\Util;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Kernel;
...@@ -18,6 +18,8 @@ use Symfony\Component\Process\Process; ...@@ -18,6 +18,8 @@ use Symfony\Component\Process\Process;
/** /**
* The Compiler class compiles the Silex framework. * The Compiler class compiles the Silex framework.
* *
* This is deprecated. Use composer instead.
*
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*/ */
class Compiler 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