Download the PHP package frolaxhq/laravel-typescript without Composer

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

Generate TypeScript interfaces from your Eloquent models automatically. Keep your frontend types in sync with your database schema and model definitions.


📚 Read the Full Documentation


✨ Features

Requirements

Installation

Publish the configuration:

Quick Start

Generate TypeScript definitions:

Output to stdout:

Generate for a specific model:

Output Example

Given this Eloquent model:

The generated TypeScript:

CLI Commands

typescript:generate

Generate TypeScript definitions from Eloquent models.

Option Description
model Generate for a specific model only
--output=PATH Output path (overrides config)
--writer=TYPE Writer: interface, type, or json
--enum-style=STYLE Enum style: const_object, ts_enum, union
--global Wrap in declare namespace
--plurals Pluralize type names (UserUsers)
--fillables Generate fillable-only types
--no-relations Exclude relations
--no-counts Exclude relation counts
--timestamps-as-date Map timestamps to Date instead of string
--optional-nullables Make nullable columns optional (name?: type)
--connection=NAME Database connection to use
--strict Bail on first model error
--stdout Output to stdout only

typescript:inspect

Inspect a model's metadata:

typescript:mappings

Show current type mappings:

Configuration

All options are documented in config/typescript.php. Key sections:

Discovery

Output

Writer

Relations

Custom Type Mappings

Naming Convention

Formatter

Incremental Builds

Extension API

Use the Typescript facade to extend the package:

Custom Type Mappers

Forced Type Overrides

Use the $interfaces property on your model:

String form and object form can be mixed in the same model.

Entries in $interfaces are emitted even when the field is not a database column, accessor, or appended attribute. If the field already exists, the entry acts as a forced type override.

When using import, generated files include import type statements automatically. If multiple fields reference the same symbol/path pair, it is imported only once per output file.

Example generated import block:

Architecture

The package uses a pipeline architecture:

Each stage has a clear contract and can be replaced or extended:

Module Contract Default
Discovery ModelDiscoveryContract ModelDiscovery
Introspection SchemaIntrospectorContract LaravelSchemaIntrospector
Metadata ModelMetadataExtractorContract ModelMetadataExtractor
Type Resolution TypeResolverContract TypeResolver
Relations RelationResolverContract RelationResolver
Writing WriterContract TypescriptWriter
Formatting FormatterContract NullFormatter

Type Resolution Precedence

Types are resolved using an 8-level precedence chain:

  1. Forced override$interfaces property on model
  2. API resource type — When api_resources mode is enabled
  3. Enum castAsEnumCollection, AsEnumArrayObject
  4. Accessor return type — PHP return type from accessor method
  5. Cast type — Eloquent $casts property
  6. DB column type — Raw database schema type
  7. Custom user mapping — From config('typescript.mappings.custom')
  8. Fallbackunknown

Testing

The test suite includes 135+ tests covering:

License

MIT


All versions of laravel-typescript with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
spatie/laravel-package-tools Version ^1.16
composer/class-map-generator Version ^1.4
illuminate/contracts Version ^11.0|^12.0|^13.0
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 frolaxhq/laravel-typescript contains the following files

Loading the files please wait ...