Download the PHP package j0hnys/trident-typed without Composer

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

Improved PHP type system in userland

This package is a mere proof of concept about what's possible in PHP's userland to improve type checking. It adds support for type inference, generics, union types, typed lists, tuples and structs. Because all is done in userland, there are limitations on what syntax is possible.

Installation

You can install the package via composer:

Usage

Type inference

Both collections, tuples and structs support inferred types. This means that all examples are also possible, without manually specifying types. For example:

The following examples all show the manual type configuration. There are some cases where type inference falls short, and you have to fall back on manually defining them. You might also prefer the manual approach, for clarity's sake.

Note that type may be partially inferred. Some fields in tuples or structs may be type definitions, others may be real values. Uninitialised types will throw an error on read.

Typed lists and collections:

It's possible to directly initialise a collection with data after construction.

This package also provides some predefined lists, as shortcuts.

Maps:

It's possible to directly initialise a collection with data after construction.

Generics:

Generic types wrap around classes, allowing you to not creating a custom type for every class.

Tuples:

Like lists, a tuple can also be given some data after construction with the set function.

Structs:

Nullable type

A nullable type can be defined in two, functionally identical, ways:

Union Type

A union type means a collection of multiple types.

Union types may also be nullable and contain generics.

What's not included:

Creating your own types

The GenericType or T::generic() can be used to create structures of that type. It is, however, also possible to create your own types without generics. Let's take the example of Post. The generic approach works without adding custom types.

The generic part can be skipped if you create your own type.

Now you can use PostType directly:

You're also free to extend the T helper.

The Nullable trait adds the following simple snippet, so that the type can be made nullable when used.

Note: It's recommended to also implement __toString in your own type classes.

Extending data structures

You're free to extend the existing data structures. For example, you could make shorthand tuples like so:


All versions of trident-typed with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 j0hnys/trident-typed contains the following files

Loading the files please wait ....