Download the PHP package apie/schema-generator without Composer

On this page you can find all versions of the php package apie/schema-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 schema-generator

schema-generator

Latest Stable Version Total Downloads Latest Unstable Version License PHP Composer

PHP Composer

This package is part of the Apie library. The code is maintained in a monorepo, so PR's need to be sent to the monorepo

Documentation

The schema generator creates a JSON Schema from an object with typehints. It supports entities, lists, hashmaps, value objects and DTO made for Apie. It returns objects made with the library cebe/php-openapi.

This library does not generate an entire OpenAPI schema, but instead it just creates the JSON schema section of all the objects.

Standard usage

In general you make multiple schemas for multiple objects with references. Because of that we basically create a Components section

Code example:

DTO's

DTO's will be mapped as objects and all fields required unless it has the Optional attribute or a default value.

Will Result in this schema:

Enums

Enums will be mapped with type string or int and all the values in the enum property.

Backed enums will use the value of the enum. Enums without values use the names and are always mapped as strings.

Entities

Entities will be mapped by reading the constructor arguments and all the methods starting with set or with.

Any constructor argument is considered a required option, unless it has a default value.

For all methods starting with set or with it expects the last argument to be the type needed. Other arguments are considered for contextual reasons (like being authenticated or the current locale).

Value Objects

It tries to figure out what value objects the object is. For example if it uses one of the standard traits it will map those to objects or strings or read the toNative() return typehint.

Complete customization

You can add SchemaMethod attribute to a class and add a static method class to specify an openAPI schema for a class.

The method can return an instance of cebe\Openapi\Schema (you require cebe/php-openapi") or return an array of the schema.


All versions of schema-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
apie/core Version self.version
apie/dateformat-to-regex Version self.version
devizzent/cebe-php-openapi Version ^1.1.2
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 apie/schema-generator contains the following files

Loading the files please wait ....