Skip to content

Instantly share code, notes, and snippets.

@jeroendesloovere
Last active February 27, 2018 13:57
Show Gist options
  • Save jeroendesloovere/92cbd68d675b3491db0bd6a45d17a0c7 to your computer and use it in GitHub Desktop.
Save jeroendesloovere/92cbd68d675b3491db0bd6a45d17a0c7 to your computer and use it in GitHub Desktop.
Fork CMS core rules

Fork CMS core rules

PHP

  • 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

Symfony service-ids

  • Every core Fork CMS service should have a forkcms prefix, f.e.: forkcms.repository.meta

Entities

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 and ForkCMS\Domain\Meta\Command\CreateMetaHandler
  • ValueObject + DBALType: ForkCMS\Domain\Meta\SeoIndex and ForkCMS\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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment