Download the PHP package nolanos/laravel-model-typescript-transfomer without Composer

On this page you can find all versions of the php package nolanos/laravel-model-typescript-transfomer. 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 laravel-model-typescript-transfomer

Laravel Model Typescript Transformer

This package generates TypeScript definitions for Laravel Eloquent models using spatie/laravel-typescript-transformer.

Installation

Install via Composer:

Update your config/typescript-transformer.php config file by...

Usage

Generate TypeScript definitions by running:

How it works

Identifying Properties

The ModelTransformer identifies the properties of the given Model by looking at the columns in the database table, and then filters columns out based on the $hidden and $visible properties of the model.

Mapping Database Types to TypeScript Types

Property types are determined by mapping the database column type to a TypeScript type. The following mappings are used:

Typescript Type Database Type
string uuid, string, text, varchar, character varying, date, datetime, timestamp, timestamp without time zone, bpchar, timestamptz, time, bytea, blob
number integer, bigint, int2, int4, int8, float, double, decimal, float8, numeric
boolean boolean, bool

Note: Unknown column types will be mapped to unknown and are followed by a comment stating the db type.

Nullable Types

If a column is nullable, the TypeScript type will be suffixed with | null.

Example

Let's look at a simple of example of a user model in a PostgreSQL database.

The User model might look like this:

`

Will generate the following TypeScript definition:

Limitations

This package has some limitations.

Take a look at the issues to see what's missing.

Development

Setup

Running Tests

Publishing new Versions

To publish a new version of the package, you need to create a new tag and push it to the repository.

Go to Packagist and click on "Update" to update the package.


All versions of laravel-model-typescript-transfomer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^9.0|^10.0|^11.0
spatie/laravel-typescript-transformer Version ^2.4
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 nolanos/laravel-model-typescript-transfomer contains the following files

Loading the files please wait ....