Download the PHP package isaiasg3/laravel-inertia-type-sync without Composer

On this page you can find all versions of the php package isaiasg3/laravel-inertia-type-sync. 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-inertia-type-sync

laravel-inertia-type-sync

Latest Version License

Automatic End-to-End Type Safety between Laravel and Inertia.js + Vue 3, without any additional PHP annotations.

The Problem

In a typical Inertia.js app, the contract between the backend and frontend lives in two completely separate places that are never validated against each other:

When someone adds a required field in the backend and forgets to update the frontend (or vice versa), the error only shows up in production, not at compile time. Tools like spatie/laravel-typescript-transformer solve this very well, but they require you to manually annotate every DTO or Resource with PHP attributes.

laravel-inertia-type-sync analyzes your code just as you write it — using Reflection over rules() and AST analysis over toArray() — and generates a single synchronized .d.ts file with a simple Artisan command.

Installation

You can install the package via Composer:

Optionally, you can publish the configuration file:

Check the config/inertia-type-sync.php file to adjust the scanning paths and your models' base namespace if it's different from App\Models.

Usage

Run the following command to generate your types:

This will generate a file at resources/js/types/generated.d.ts with a TypeScript interface for every FormRequest and JsonResource detected in your project:

In a Vue 3 component (Composition API)

Forms with useForm — Inertia's generic type validates every v-model against the generated interface:

Typed Props from a JsonResource:

Keeping the file synced automatically

Integrate the command into your usual workflow by adding it to your composer.json scripts:

This way, every time you run composer dump-autoload or install a new package, your TypeScript types will be automatically updated.

How it works under the hood

PHP Source Technique Result
FormRequest::rules() PHP Reflection + rule parser Interface with primitive types, literal unions (in:), and nested arrays (items.*.sku)
JsonResource::toArray() AST Analysis (nikic/php-parser) over the method's source code Interface with types inferred from Eloquent $casts, nested resources, and optional when()/whenLoaded() fields

Known Limitations

Contributing

Pull Requests are welcome! Please run composer test and composer analyse before submitting your changes.

License

The MIT License (MIT).


All versions of laravel-inertia-type-sync with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
symfony/finder Version ^6.0|^7.0|^8.0
nikic/php-parser Version ^5.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 isaiasg3/laravel-inertia-type-sync contains the following files

Loading the files please wait ...