Setting Project Namespace

By default Symfony projects all have a base App namespace

However for our purposes we prefer to give each project it's own root namespace

There are a few places that need to update for this to work:

Find and Replace

Generally, you can simply find App\ and replace with ProjectName\

  • composer.json
  • src/Kernel.php
  • bin/console
  • config/services.yml

Maker Bundle

We need to configure Maker bundle to use our namespace:

config/packages/dev/maker.yaml

1
2
3
4
5
6
7
# config/packages/dev/maker.yaml
# create this file if you need to configure anything
maker:
  # tell MakerBundle that all of your classes lives in an
  # Acme namespace, instead of the default App
  # (e.g. Acme\Entity\Article, Acme\Command\MyCommand, etc)
  root_namespace: 'BallicomCustomerApi'