Download the PHP package calvient/puddleglum without Composer

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

Puddleglum

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Puddleglum allows you to automatically generate TypeScript interfaces from your Laravel models and requests as well as a typesafe Axios implementation for your API routes.

This package is based on lepikhinb/laravel-typescript. Special thanks for such an awesome package!

Introduction

If you, like Calvient, have a Laravel backend with a TS front-end (be it React, Vue, or something else), you might have noticed that you have to manually keep your TypeScript interfaces in sync with your Laravel models and requests. You might also have noticed that you have to manually keep your Axios implementation in sync with your Laravel routes.

Puddleglum is a Laravel package that solves these problems by automatically generating Typescript interfaces and a simple API implementation based on Axios.

Installation

Laravel 8 and PHP 8 are required. You can install the package via composer:

You can publish the config file with:

This is the contents of the published config file:

Usage

Generate TypeScript interfaces.

Defining your requests

In Laravel, you might define your requests from the command line like this:

If you do this (i.e., your requests extend FormRequest), Puddleglum will automatically generate TypeScript interfaces for your requests. The program reads the rules from your FormRequest and generates TypeScript interfaces for your requests.

For example:

Becomes:

If you don't want to define a FormRequest (e.g., you want to use a request validator directly in your controller), you can use the GlumRequest attribute before your controller.

Example;

Defining Responses

Defining a response is a bit trickier, because PHP lacks support for generics. However, Puddleglum can still generate TypeScript interfaces for your responses.

We accomplish this by using a PHP attribute.

Example:

Using the Puddleglum Output in your TypeScript code

Import the Puddleglum client into your TypeScript code:

Then, you can use the Puddleglum client to make API calls:

The API client mirrors the PHP namespace. So, in the example above, the login controller is at \App\Http\Controllers\Auth and the method is named login.

You can also import various models and requests.

License

The MIT License (MIT). Please see License File for more information.


All versions of puddleglum with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
doctrine/dbal Version ^3.1
illuminate/contracts Version ^8.37|^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.11.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 calvient/puddleglum contains the following files

Loading the files please wait ....