Install a third-party bundle
1. Use Composer to install
composer require friendsofsymfony/user-bundle=》composer require bundelName
Search for some third-party bundles Packagist.org
The above command will select the most appropriate version for your project. If you need to specify a version, use the command
<span>$ </span>composer require friendsofsymfony/user-bundle <span>"~2.0"</span>
composer.json
, and download the code to the vendor directory. 2. Register in AppKernel
<span>public</span><span>function</span><span>registerBundles</span><span>()</span><span>{</span><span>$bundles</span><span>=</span><span>array</span><span>(</span><span>// ...</span><span>new</span><span>FOS\UserBundle\FOSUserBundle</span><span>(),</span><span>);</span><span>// ...</span><span>}</span>
<span>class</span><span>AppKernel</span><span>extends</span><span>Kernel</span><span>{</span><span>// ...</span><span>public</span><span>function</span><span>registerBundles</span><span>()</span><span>{</span><span>$bundles</span><span>=</span><span>array</span><span>(</span><span>// ...</span><span>);</span><span>if</span><span>(</span><span>in_array</span><span>(</span><span>$this</span><span>-></span><span>getEnvironment</span><span>(),</span><span>array</span><span>(</span><span>'dev'</span><span>,</span><span>'test'</span><span>)))</span><span>{</span><span>$bundles</span><span>[]</span><span>=</span><span>new</span><span>Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle</span><span>();</span><span>}</span><span>// ...</span><span>}</span><span>}</span>
Configure in this file app/config/config.yml
config:dump-reference AsseticBundle
The above introduces the symfony study notes-bundle1, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.