Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9019509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:47:43+00:00 2026-06-16T04:47:43+00:00

I’m new to Symfony2 and I have faced some simple problem but I’m not

  • 0

I’m new to Symfony2 and I have faced some simple problem but I’m not sure how to manage with it. I need to use one simple 3rd party class and I’m not sure where and how to store it in project structure. Should I store is a Service in my Bundle or maybe I should store it in vendors directory? And if I’ll store it in vendors isn’t it a bad practice to store there the libs that isn’t Symfony supported vendors?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:47:44+00:00Added an answer on June 16, 2026 at 4:47 am

    Usually you include those in your project with Composer. I suggest you to take a look at packagist to look if there is a Composer package for your class, otherwise you can’t require it with composer.

    Composer puts your classes in the vendor 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.

    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 Foo you create a Acme\FooBundle which loads the Foo service:

    // src/Acme/FooBundle/DependencyInjection/AcmeFooExtension.php
    <?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->load('services.xml');
        }
    
    <!-- src/Acme/FooBundle/Resources/config/services.xml -->
    <?xml version="1.0" encoding="UTF-8" ?>
    
    <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">
    
        <services>
            <!-- Loads the \Foo class as a acme_foo.foo service -->
            <service id="acme_foo.foo"
                class="\Foo"
            ></service>
        </services>
    
    </container>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I have been unable to fix a problem with Java Unicode and encoding. The
I need a function that will clean a strings' special characters. I do NOT
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.