Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Usually you include those in your project with <a href="http://getcomposer.com/" rel="nofollow">Composer</a>. I suggest you to take a look at <a href="http://packagist.org/" rel="nofollow">packagist</a> to look if there is a Composer package for your class, otherwise you can't require it with composer.</p> <p>Composer puts your classes in the <code>vendor</code> directory, you should put all 'vendors' (3th party libraries) there. Take a look on where to put them in that directory, so that the Composer autoloader can autoload it.</p> <p>After that, it is recommend to create a bundle for that specific class. It is a best practise to create a service there. For instance, if your class is <code>Foo</code> you create a <code>Acme\FooBundle</code> which loads the <code>Foo</code> service:</p> <pre class="lang-php prettyprint-override"><code>// src/Acme/FooBundle/DependencyInjection/AcmeFooExtension.php &lt;?php namespace Acme\FooBundle\DependencyInjection; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; class AcmeFooExtension extends Extension { /** * this method loads the Service Container services. */ public function load(array $configs, ContainerBuilder $container) { $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); // load the src/Acme/FooBundle/Resources/config/services.xml file $loader-&gt;load('services.xml'); } </code></pre> <pre class="lang-xml prettyprint-override"><code>&lt;!-- src/Acme/FooBundle/Resources/config/services.xml --&gt; &lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"&gt; &lt;services&gt; &lt;!-- Loads the \Foo class as a acme_foo.foo service --&gt; &lt;service id="acme_foo.foo" class="\Foo" &gt;&lt;/service&gt; &lt;/services&gt; &lt;/container&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload