Download the PHP package salemc/typescriptify-laravel-models without Composer

On this page you can find all versions of the php package salemc/typescriptify-laravel-models. 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 typescriptify-laravel-models

TypeScriptify Laravel Models

Effortlessly generate TypeScript interface definitions from Laravel Model classes.

Usage

The main invocation of php artisan typescriptify:model with --help lists sub-commands available:

Example Usage

Invocating php artisan typescriptify:model \App\Models\User on a fresh Laravel installation will produce:

Or if you prefer, you can instantiate your own version of the TypeScriptifyModel class:

Relation Mapping

TypeScriptify Laravel Models supports belongsTo relation mapping.

Imagine you have the following scenario:

With a foreign key (and a foreign key constraint) role_id on the users table.

It would be nice if instead of having a role_id: number attribute on the generated User interface, it was instead the full relational dataset, right? Well, TypeScriptify Laravel Models is able to recognise that the role_id column should be the Role model, and will map it to a reusable interface definition for you. Unfortunately, we're not able to determine the exact relation name; instead we attempt to guess it for you, based on the foreign key name:

How It Works

Database

TypeScriptify Laravel Models works primarily by gathering column data from the database your Laravel instance is setup with. Once gathered, it maps column types to known TypeScript types. This means if you don't have a database column for a property you want converted, it won't exist in the final TypeScript interface definition.

Casts

TypeScriptify Laravel Models also respects predictable Laravel casts (specifically protected $casts and protected $dates) you've setup in the model being converted. It will map all known casts to TypeScript types.

Caveats

TypeScriptify Laravel Models is only able to map predictable data types to TypeScript types. Custom Casts and Custom Accessors are not, and cannot be supported.

If TypeScriptify Laravel Models fails to map a type to a TypeScript type, it will set the value to unknown in the TypeScript interface definition.


All versions of typescriptify-laravel-models with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
doctrine/dbal Version ^3.4
illuminate/support Version ^9.36
illuminate/database Version ^9.36
illuminate/console Version ^9.36
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 salemc/typescriptify-laravel-models contains the following files

Loading the files please wait ....