Skip to content

Commit

Permalink
deprecated the phar
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed May 24, 2012
1 parent fc44ff2 commit 1dcc05d
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 116 deletions.
2 changes: 1 addition & 1 deletion compile
Expand Up @@ -3,7 +3,7 @@

require_once __DIR__.'/vendor/autoload.php';

use Silex\Compiler;
use Silex\Compiler\Util;

$compiler = new Compiler();
$compiler->compile();
3 changes: 2 additions & 1 deletion doc/index.rst
Expand Up @@ -13,4 +13,5 @@ Silex
internals
contributing
providers/index
changelog
changelog
phar
12 changes: 6 additions & 6 deletions doc/intro.rst
Expand Up @@ -22,7 +22,7 @@ step.

**Let's go!**::

require_once __DIR__.'/silex.phar';
require_once __DIR__.'/vendor/autoload.php';

$app = new Silex\Application();

Expand All @@ -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
Expand All @@ -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
90 changes: 90 additions & 0 deletions doc/phar.rst
@@ -0,0 +1,90 @@
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
4 changes: 2 additions & 2 deletions doc/providers/doctrine.rst
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions doc/providers/monolog.rst
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions doc/providers/swiftmailer.rst
Expand Up @@ -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
--------

Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions doc/providers/translation.rst
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/providers/twig.rst
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions doc/providers/validator.rst
Expand Up @@ -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
Expand Down
91 changes: 4 additions & 87 deletions doc/usage.rst
Expand Up @@ -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();

Expand Down Expand Up @@ -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
--------------------

Expand Down
8 changes: 0 additions & 8 deletions example.htaccess

This file was deleted.

4 changes: 3 additions & 1 deletion src/Silex/Compiler.php → src/Silex/Util/Compiler.php
Expand Up @@ -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;
Expand All @@ -18,6 +18,8 @@
/**
* The Compiler class compiles the Silex framework.
*
* This is deprecated. Use composer instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class Compiler
Expand Down

0 comments on commit 1dcc05d

Please sign in to comment.