{"id":218813,"date":"2020-01-24T14:13:58","date_gmt":"2020-01-24T14:13:58","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=218813"},"modified":"2020-01-25T08:50:33","modified_gmt":"2020-01-25T08:50:33","slug":"how-to-autoload-bundle-in-symfony-using-composer","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/","title":{"rendered":"How to AutoLoad Bundle in Symfony using composer"},"content":{"rendered":"\n<p>First We need to know that use case of a bundle and why we are using it. if you want to create a specific feature library then you can create a bundle but bundle can be accessible publicly or private. but most of the case bundles are inside the src folder if you want to manage your bundle outside of the <strong>src<\/strong> folder then how will you manage bundle.<\/p>\n\n\n\n<p>All of the bundles autoloading with help of namespaces. it means first you need to define a namespace for your bundle but where you need to define it.<\/p>\n\n\n\n<p>let&#8217;s start<\/p>\n\n\n\n<p>Goto project root directory and open <strong>composer.json <\/strong>file and find<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p><img decoding=\"async\" width=\"834\" height=\"185\" class=\"wp-image-225739\" style=\"width: 750px\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png\" alt=\"testssss\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png 834w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss-300x67.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss-250x55.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss-768x170.png 768w\" sizes=\"(max-width: 834px) 100vw, 834px\" loading=\"lazy\" \/><\/p>\n<\/div><\/div>\n\n\n\n<p>Then create your bundle which is must be inside <strong>Ecommerce<\/strong> Directory and Bundle name <strong>AcmeBundle<\/strong>.<\/p>\n\n\n\n<p><img decoding=\"async\" width=\"734\" height=\"194\" class=\"wp-image-225860\" style=\"width: 750px\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/3333333.png\" alt=\"3333333\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/3333333.png 734w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/3333333-300x79.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/3333333-250x66.png 250w\" sizes=\"(max-width: 734px) 100vw, 734px\" loading=\"lazy\" \/><\/p>\n\n\n\n<p>After complete define namespace, you need to run the following command.<\/p>\n\n\n\n<p><strong>composer dump-autoload <\/strong><\/p>\n\n\n\n<p>so that making changes can occur.<\/p>\n\n\n\n<p>After running the command you can register bundle according to Symfony configuration and start coding&#8230;&#8230;<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>First We need to know that use case of a bundle and why we are using it. if you want to create a specific feature library then you can create a bundle but bundle can be accessible publicly or private. but most of the case bundles are inside the src folder if you want to <a href=\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":257,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-218813","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to AutoLoad Bundle in Symfony using composer - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to AutoLoad Bundle in Symfony using composer - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"First We need to know that use case of a bundle and why we are using it. if you want to create a specific feature library then you can create a bundle but bundle can be accessible publicly or private. but most of the case bundles are inside the src folder if you want to [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-24T14:13:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-01-25T08:50:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png\" \/>\n<meta name=\"author\" content=\"Firoj Ahmad\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Firoj Ahmad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/\"},\"author\":{\"name\":\"Firoj Ahmad\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/7f4680d863d8097b747c371832ae35f2\"},\"headline\":\"How to AutoLoad Bundle in Symfony using composer\",\"datePublished\":\"2020-01-24T14:13:58+00:00\",\"dateModified\":\"2020-01-25T08:50:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/\"},\"wordCount\":167,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/\",\"name\":\"How to AutoLoad Bundle in Symfony using composer - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png\",\"datePublished\":\"2020-01-24T14:13:58+00:00\",\"dateModified\":\"2020-01-25T08:50:33+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png\",\"width\":834,\"height\":185,\"caption\":\"testssss\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to AutoLoad Bundle in Symfony using composer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/7f4680d863d8097b747c371832ae35f2\",\"name\":\"Firoj Ahmad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b91da5900044dbed0102a45259a853edd371528e0a023b754c989ef2a591b107?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b91da5900044dbed0102a45259a853edd371528e0a023b754c989ef2a591b107?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Firoj Ahmad\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/firoj-ahmad121\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to AutoLoad Bundle in Symfony using composer - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/","og_locale":"en_US","og_type":"article","og_title":"How to AutoLoad Bundle in Symfony using composer - Webkul Blog","og_description":"First We need to know that use case of a bundle and why we are using it. if you want to create a specific feature library then you can create a bundle but bundle can be accessible publicly or private. but most of the case bundles are inside the src folder if you want to [...]","og_url":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2020-01-24T14:13:58+00:00","article_modified_time":"2020-01-25T08:50:33+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png","type":"","width":"","height":""}],"author":"Firoj Ahmad","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Firoj Ahmad","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/"},"author":{"name":"Firoj Ahmad","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/7f4680d863d8097b747c371832ae35f2"},"headline":"How to AutoLoad Bundle in Symfony using composer","datePublished":"2020-01-24T14:13:58+00:00","dateModified":"2020-01-25T08:50:33+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/"},"wordCount":167,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/","url":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/","name":"How to AutoLoad Bundle in Symfony using composer - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png","datePublished":"2020-01-24T14:13:58+00:00","dateModified":"2020-01-25T08:50:33+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/01\/testssss.png","width":834,"height":185,"caption":"testssss"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-autoload-bundle-in-symfony-using-composer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to AutoLoad Bundle in Symfony using composer"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/7f4680d863d8097b747c371832ae35f2","name":"Firoj Ahmad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b91da5900044dbed0102a45259a853edd371528e0a023b754c989ef2a591b107?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b91da5900044dbed0102a45259a853edd371528e0a023b754c989ef2a591b107?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Firoj Ahmad"},"url":"https:\/\/webkul.com\/blog\/author\/firoj-ahmad121\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/218813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/257"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=218813"}],"version-history":[{"count":14,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/218813\/revisions"}],"predecessor-version":[{"id":225861,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/218813\/revisions\/225861"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=218813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=218813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=218813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}