Download the PHP package openclassrooms/code-generator without Composer

On this page you can find all versions of the php package openclassrooms/code-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package code-generator

CodeGenerator

Build Status SensioLabsInsight

CodeGenerator is a library which generates classes in a Clean Architecture context.

From any use case response, developers have the possibility to generate:

Installation

The easiest way to install CodeGenerator is via composer.

Create the following composer.json file or run the php composer.phar install command to install it.

or

Setup post-install and post-update hooks in your composer.json's script section, for the oc_code_generator.yml default configuration to be generated. This file is mandatory for the code generator to work.

The script creates a file named oc_code_generator.yml at the root of the project, and will ask you interactively for parameters which are missing in the parameters file, using the values of the dist file as default values, as follows:

You may need to tweak these values depending on the project you are using the code generator in.

Usage

Basic execution

To list all commands:

To generate a view model architecture:

To generate a generic use case architecture:

To generate an entity CRUD use case architecture:

Extensions

To generate without tests:

To generate view model architecture tests only if view model classes already exist:

To dump preview for view model classes:

Using the code generator in PHPStorm

You can set up External Tools entries in PHPStorm to be able to run some code generator command from your IDE by right-clicking on classes in the project tree (e.g., an entity class).

For the generic use case generation, add an external tool entry like this:

Program: /usr/local/bin/php Arguments: bin/code-generator code-generator:generic-use-case $Prompt$ Working Directory: $ProjectFileDir$

For a get entity use case generation, add an external tool entry like this:

Program: /usr/local/bin/php Arguments: bin/code-generator code-generator:get-entity-use-case $FilePath$ $Prompt$ Working Directory: $ProjectFileDir$

Note that this will only work if the code generator is correctly setup in your project's composer.json. You may need to tweak this for your local PHP binary path.

How to create a new generator

To know

Methodology

1) Write the file templates you want to generate

First, you have to create twig templates for the expected files after generation.

2) Create generator RequestDTO and generator RequestBuilder

Create class with the entity name suffixed by RequestBuilder , this is used as parameter in generator main method.

3) Start Generator Implementation

The main goal of the generator class is to generate the expected FileObject, but to succeed, it is necessary to build other FileObject from factories and use available Utilities.

4) Create GeneratorTest

Create class with the entity name suffixed by GeneratorTest and the related stub class (entity name suffixed by FileObjectStub1). The stub MUST contain expected values to compare with the actual object.

5) Create skeletonModel and SkeletonModelAssembler

Create two classes both prefixed by the entity name:

See an example

For a practical example, check how src/Generator/ViewModelGenerator.php is built.


All versions of code-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
composer/composer Version ~1.8
doctrine/annotations Version ~1.6
doctrine/inflector Version ~1.3
fzaninotto/faker Version ^1.8
incenteev/composer-parameter-handler Version ~2.0
nesbot/carbon Version ~1.22 || ~2.1
symfony/config Version ~3.3 || ~4.0
symfony/console Version ~3.3 || ~4.0
symfony/dependency-injection Version ~3.3 || ~4.0
symfony/filesystem Version ~3.3 || ~4.0
symfony/finder Version ~3.3 || ~4.0
symfony/yaml Version ~3.3 || ~4.0
twig/twig Version ^1.38 || ^2.7
openclassrooms/cache Version 1.0.x@dev
openclassrooms/use-case Version 1.0.x@dev
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package openclassrooms/code-generator contains the following files

Loading the files please wait ....