8000 Documentation of the new PSR-4 class loader. by derrabus · Pull Request #3686 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Documentation of the new PSR-4 class loader. #3686

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 5 commits into from
Mar 18, 2014
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Minor corrections.
  • Loading branch information
derrabus committed Mar 17, 2014
commit a05da41b86f713f4acf5dd8f9b721ea160c7fce8
6 changes: 3 additions & 3 deletions components/class_loader/psr4_class_loader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The directory structure will look like this:
Yaml.php
...
config.yml
test.php
demo.php

In ``demo.php`` you are going to parse the ``config.yml`` file. To do that, you
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you talk about demo.php here, you mean test.php?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

first need to configure the ``Psr4ClassLoader``:
Expand All @@ -55,13 +55,13 @@ first need to configure the ``Psr4ClassLoader``:
$loader->addPrefix('Symfony\\Component\\Yaml\\', __DIR__.'/lib/Yaml');
$loader->register();

$data = Yaml::parse(__DIR__.'/demo.yml');
$data = Yaml::parse(__DIR__.'/config.yml');

First of all, the class loader is loaded manually using a ``require``
statement, since there is no autoload mechanism yet. With the
:method:`Symfony\Component\ClassLoader\Psr4ClassLoader::addPrefix` call, you
tell the class loader where to look for classes with the
``Symfony\Component\Yaml\`` namespace prefix. After registering the autoloader,
the Yaml component is ready to use.
the Yaml component is ready to be used.

.. _PSR-4: http://www.php-fig.org/psr/psr-4/
0