From 038c2dd0a6b81e950e2ccffb4153afa2560d853b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C5=82odzimierz=20Gajda?= Date: Tue, 6 Nov 2012 11:26:30 +0100 Subject: [PATCH] [Cookbook] How to use components --- cookbook/workflow/index.rst | 1 + cookbook/workflow/new_project_components.rst | 68 ++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 cookbook/workflow/new_project_components.rst diff --git a/cookbook/workflow/index.rst b/cookbook/workflow/index.rst index 6b2382ae235..a524a0ee262 100644 --- a/cookbook/workflow/index.rst +++ b/cookbook/workflow/index.rst @@ -6,3 +6,4 @@ Workflow new_project_git new_project_svn + new_project_components diff --git a/cookbook/workflow/new_project_components.rst b/cookbook/workflow/new_project_components.rst new file mode 100644 index 00000000000..de6102ec347 --- /dev/null +++ b/cookbook/workflow/new_project_components.rst @@ -0,0 +1,68 @@ +.. index:: + single: Workflow; Components + +How to start a new project using Symfony2 Components +==================================================== + +Using Finder Component +---------------------- + +1. Create a new empty folder. + +2. Create a new file called ``composer.json`` and paste the following into it: + + .. code-block:: json + + { + "require": { + "symfony/finder": "2.1.*" + } + } + +3. Download vendor libraries and generate ``vendor/autoload.php`` file: + + .. code-block:: bash + + $ php composer.phar install + +4. Write your code: + + .. code-block:: php + + in('../data/'); + + ... + +.. tip:: + + If you want to use all the Symfony2 Component, then instead of adding them one by one: + + .. code-block:: json + + { + "require": { + "symfony/finder": "2.1.*", + "symfony/dom-crawler": "2.1.*", + "symfony/css-selector": "2.1.*" + ... + } + } + + use: + + .. code-block:: json + + { + "require": { + "symfony/symfony": "2.1.*" + } + }