A.Seddighi
A.Seddighi

Reputation: 1765

Symfony 4 bundles working

How can I create library bundle on Symfony 4?

In Symfony 3 I use this command: php bin/console generate:bundle but in new version not working. And is possible use bundles like Symfony 3, for example, i have blog bundle and telegram bot bundle if not possible how to simulate in Symfony 4?

Upvotes: 15

Views: 9773

Answers (5)

GuillaumeL
GuillaumeL

Reputation: 639

the logic for creating bundle doesn't change since Symofony 2.x. But now bundles are just packages, use for reusable features. If you want to develop your own bundle just follow this post Symfony2 - creating own vendor bundle - project and git strategy Since Symfony Generate Bundle isn't supported anymore in 4.x you have to follow this other post: Best Practices for Reusable Bundles

Upvotes: 4

Mestiri Abderrahim
Mestiri Abderrahim

Reputation: 1

Start by creating a src/Acme/TestBundle/ directory and adding a new file called AcmeTestBundle.php:

// src/Acme/TestBundle/AcmeTestBundle.php
namespace App\Acme\TestBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeTestBundle extends Bundle
{
}

After add this line in config/bundles.php :

App\Acme\TestBundle\AcmeTestBundle::class => ['all' => true],

Upvotes: -1

rapaelec
rapaelec

Reputation: 1330

just try to install GeneratorBundle: more info

composer require sensio/generator-bundle

and after you can generate your Bundle like this : more info

php bin/console generate:bundle

Upvotes: 0

muskose
muskose

Reputation: 73

Fabien Potencier said in the Symfony 4 best practices blog post "Bundle-less applications is just one of the best practices changes for Symfony 4".

You must not generate new bundles, you can use default "App" bundle for your whole project.

You can look at this url for blog post about subject Symfony 4: Monolith vs Micro

Upvotes: 0

BlueM
BlueM

Reputation: 3861

The SensioGeneratorBundle has been superseded by the Symfony Maker Bundle – see https://symfony.com/blog/introducing-the-symfony-maker-bundle for more information.

Upvotes: 0

Related Questions