- Vendor namespace
ForkCMS
- We follow the PSR-2 coding style guide
- Class names in PascalCase, f.e.:
class Url{}
,class FirstName{}
- All abbreviations need to be PascalCased - Method names in camelCase, f.e.:
function getUrl(){}
,function getFirstName(){}
- All abbreviations need to be camelCased
- Every core Fork CMS service should have a
forkcms
prefix, f.e.:forkcms.repository.meta
We group the logic for an Entity in Domain
folders, two possible locations for your Domain folder:
ForkCMS\Domain\...
ForkCMS\Backend\Modules\...\Domain\...
Example for Meta:
- Entity:
ForkCMS\Domain\Meta\Meta
- Repository:
ForkCMS\Domain\Meta\MetaRepository
- Form:
ForkCMS\Domain\Meta\MetaType
- Repository:
ForkCMS\Domain\Meta\MetaRepository
- Command:
ForkCMS\Domain\Meta\Command\CreateMeta
andForkCMS\Domain\Meta\Command\CreateMetaHandler
- ValueObject + DBALType:
ForkCMS\Domain\Meta\SeoIndex
andForkCMS\Domain\Meta\SeoIndexDBALType
- Exception:
ForkCMS\Domain\Meta\Exception\MetaNotFound
- If lots of ValueObjects, they can be grouped in a subnamespace, f.e.:
ForkCMS\Domain\Meta\Robots\SeoIndex
,ForkCMS\Domain\Meta\Robots\SeoFollow