From fca061e3e613d622a83fe558915f57d7e97762f9 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Sun, 23 Aug 2020 19:54:18 +0200 Subject: [PATCH] Update using_components.rst --- components/using_components.rst | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/components/using_components.rst b/components/using_components.rst index 0b77e4f6a4e..0b9bcde5083 100644 --- a/components/using_components.rst +++ b/components/using_components.rst @@ -20,7 +20,7 @@ Using the Finder Component **1.** If you're creating a new project, create a new empty directory for it. -**2.** Open a terminal and use Composer to grab the library. +**2.** Open a terminal, step into this directory and use Composer to grab the library. .. code-block:: terminal @@ -43,10 +43,18 @@ the ``vendor/autoload.php`` file that was generated by Composer. This file takes care of autoloading all of the libraries so that you can use them immediately:: - // File example: src/script.php - - // update this to the path to the "vendor/" - // directory, relative to this file + // Project structure example: + // my_project/ + // data/ + // ... # Some project data + // src/ + // my_script.php # Main entry point + // vendor/ + // autoload.php # Autoloader generated by Composer + // ... # Packages downloaded by Composer + + // File example: src/my_script.php + // Autoloader relative path to this PHP file require_once __DIR__.'/../vendor/autoload.php'; use Symfony\Component\Finder\Finder; @@ -54,15 +62,17 @@ immediately:: $finder = new Finder(); $finder->in('../data/'); - // ... + // rest of your PHP code... Now what? --------- Now, the component is installed and autoloaded. Read the specific component's documentation to find out more about how to use it. +All `Symfony Components`_ are documented here as standalone libraries. And have fun! .. _Composer: https://getcomposer.org .. _Install Composer: https://getcomposer.org/download/ +.. _Symfony Components: https://symfony.com/components