Skip to content

Update using_components.rst #14121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions components/using_components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -43,26 +43,36 @@ 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;

$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