Download the PHP package juanparati/model2ts without Composer

On this page you can find all versions of the php package juanparati/model2ts. 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 model2ts

Model2Ts

What is it?

An artisan command that translates Eloquent models into Typescript interfaces.

Model2Ts checks the model structure using reflection techniques, and the related table structure in order to properly infer the correct types.

Installation

    composer require juanparati/model2ts --dev

Usage

Generate Typescript interface for a specific model:

    artisan model2ts:generate "App\Models\User" user.ts

The following parameters can change the behaviour of the command:

    --ignore-hidden     : Discard attributes registered in $hidden property
    --ignore-casts      : Do not use $casts property in order to infer the attributes types
    --ignore-appends    : Do not include virtual accessor located in $appends property
    --ignore-accessors  : Do not infer types from model accessors.

Accessor's type inference

Model2Ts can infer from the native accessors and also from the virtual ones registered in the $appends property.

In order to make it work the type inference is require to define a return type in each of the accessor methods.

Example:

    public function getFirstnameAttribute() : string {
        return explode(' ', $this->attributes['name'])[0];
    }

Data structure inference

Some database types is difficult to infer the type of some attributes, because it may be used in order to store structure data. This is the case of blob and text fields. In this case the interface file will contain a comment indicating that field may be content a structure type like an object or an array.


All versions of model2ts with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
illuminate/database Version ^7 || ^8
illuminate/console Version ^6 || ^7 || ^8
illuminate/filesystem Version ^6 || ^7 || ^8
illuminate/support Version ^6 || ^7 || ^8
doctrine/dbal Version ~2.3
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 juanparati/model2ts contains the following files

Loading the files please wait ....