TramwayJS

Service

Example

tramway create:service ProductService --dependencies repository.product

Will add a new Service file with a constructor featuring dependency mapping for dependency injection.

Options

ArgumentCommand TypeTypeDefaultRequiredComments
nameargumentstringnoneyesThe name of the Service class
diroptionstringservicesnoAn option to override the default folder the Service class will be created in
dependenciesoptionarraynonenoAn array of dependencies the Service will have
add-dependency-injectionoptionbooleanfalsenoA flag to indicate that a service declaration should be created when making the Service
keyoptionstringnonenoThe name of the key to use in dependency injection configuration
dependency-injection-diroptionstringservicesnoAn option to override the default folder where the service config will be placed
dependency-injection-filenameoptionstringservicesnoAn option to override the default filename of the service config
versionoptionnumberlatestnoAn option to specify which version of the class to use