The Spryker SDK defines the following conventions.
In a task, id, short_description, version, type, and command are required properties. The task properties must meet the following conditions:
-
idmust follow the schema<group>:<language>:<subgroup>, where<group>stands for validation or generation,<language>is PHP, and<subgroup>should be a descriptive name. For example, there can be a task with the following ID:validation:php:architecture. -
versionmust follow the semver specification. -
Every task must have a
short_description. -
typecan have one of the following values:local_cli,local_cli_interactive,task_set,php. -
commandmust be an executable command string or null
A task set must have the following properties:
-
typewith thetask_setvalue. -
taskswith the list of the required sub-tasks. -
Sub-task
idin thetaskslist. -
Null value in the
commandproperty. For example,command: ~.
There are no conventions for the workflow yet.
A ValueResolver must meet the following conditions:
-
It must be suffixed with ValueResolver.
-
It must implement the ValueResolverInterface.
Note: The configurable ValueResolver interface should be preferred over the concrete implementation.
A setting must meet the following conditions:
-
Define the path with an underscore as a separator. For example,
some_setting). -
Define the scope
setting_type: sdk/local/sharedto distinguish if the setting is per project or global. -
Define a type to be either array, integer, string, boolean or float.
-
Define the strategy to be used when setting the value. The allowed values are:
merge,overwrite. -
Define
initas boolean.truemeans that this value is initially requested from the user.
A placeholder must meet the following conditions:
- The placeholder's name must start and end with
%. For example,%some_placeholder%. - Define
optional: true/falseto indicate if the placeholders needs to be resolved to run the task. - Use the
idor a full qualified class name of an existingValueResolverfor thevalueResolverfield.
A console command must meet the following conditions:
- Only basic input validation and output formatting SHOULD present in the console command.
protected static $defaultNameSHOULD NOT be used because of performance reasons and future deprecation in Symfony 6.1 version. Insteadprotected const NAMESHOULD be provided and passed to the parent constructor as a parameter.
There are the following conventions for naming entities:
-
Folder name: Must be in a singular form. For example,
Eventand notEvents. -
Class name: Must be in a singular form. For example,
AcmeTaskand notAcmeTasks. -
Method name: Core convention must be followed.
-
Variable name:Core convention must be followed.
A contract is an interface that allows users to customize the existing business logic. Contracts must meet the following conditions:
- A contract must exist only in case if the existing logic provides for an extension by the user.
- Contract is a public API and must follow Spryker plugin interfaces specification.
- Controller SHOULD have no business logic.
- Controller MUST have only one action method
__invoke. - Controller MUST be placed in namespace
SprykerSdk\Sdk\Presentation\RestApi\Controller\v1. Thev1is current version of SDK API. - Route MUST be placed in
src/Presentation/RestApi/Resources/routing.yaml - Route SHOULD be named by template
api_${version}_${controller_name}. Example: For actionValidatePhpCodestyleController::__invokeroute isapi_v1_validation_php_codestyle - Route's path SHOULD be named in hyphen-case. For task
validation:php:codestylepath is/api/v1/validation-php-codestyle
- .env usage.
- Enums.