Download the PHP package smpita/typeas without Composer

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

# Guaranteed type control for PHP Easily type your `mixed` signatures. Perfect for static analysis! [![Total Downloads](https://img.shields.io/packagist/dt/smpita/typeas.svg?style=flat-square)](https://packagist.org/packages/smpita/typeas) [![Latest Version on Packagist](https://img.shields.io/packagist/v/smpita/typeas.svg?style=flat-square)](https://packagist.org/packages/smpita/typeas) [![License](https://img.shields.io/packagist/l/smpita/typeas.svg?style=flat-square)](https://packagist.org/packages/smpita/typeas) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/smpita/typeas/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/smpita/typeas/actions?query=workflow%3Arun-tests+branch%3Amain) [![Coverage Status](https://coveralls.io/repos/github/smpita/typeas/badge.svg)](https://coveralls.io/github/smpita/typeas) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/smpita/typeas/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/smpita/typeas/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsmpita%2Ftypeas.svg?type=shield&issueType=security)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsmpita%2Ftypeas?ref=badge_shield&issueType=security) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsmpita%2Ftypeas.svg?type=shield&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsmpita%2Ftypeas?ref=badge_shield&issueType=license)

Table of Contents


Quick Start

Installation

Install the package via composer:

See SIGNATURES for the full list of methods and signatures.

Resolving types

SIGNATURES#resolving

Pass a mixed variable to get a typed variable.

Defaults

To suppress throwing exceptions, provide a default.

Array Wrapping

SIGNATURES#array

By default, array() will wrap non-iterables similar to (array) $mixed instead of throwing exceptions.


Fluent Syntax

As a convenience, TypeAs supports fluent syntax. The NonNullable and Nullable fluent classes wrap the base TypeAs methods. In performance critical environments, the standard methods are recommended.

Basic Usage

Nullable

Chain nullable() for nullable returns.

Note: Moving between NonNullable and Nullable returns a new instance of the associated class.

Custom Resolver

Chain using() to resolve using a Custom Resolver.

Defaults

Chain default() to specify a default.

Wrapping

Copying

Accessing the config

Importing a config


Custom Exceptions

Use onError() to customize the throw message or exception.

Both arguments are optional.


Extensions

Extensions are created by passing a custom resolver to a function.

Official Extensions

Custom Resolvers

SIGNATURES#resolver-registration

Each base type has an associated interface located in Smpita\TypeAs\Contracts which you can implement to make your own resolvers.

Simply implement the interface, then either register the resolver or use it in the resolver method.

Interfaces

All resolvers extend the same interfaces. Non-nullable methods throw when null is returned by a resolver.

Creating Custom Resolvers

Registering Custom Resolvers

Globally

To globally register a resolver, use the associated setter method. In Laravel, it's recommended to do this in the boot method of a ServiceProvider.

Unregistering Custom Resolvers

To return to default, set the resolver to null.

Single use

Inject a resolver to use it on a per call basis.

If you registered a custom resolver then want to use a default resolver on a per call basis, pass the default resolver class.


Helpers

SIGNATURES#helpers

Helpers follow standard signature patterns.

Global

Local

Each global helper has a local counterpart you can import if the global helper collides with another global method.


Deprecations

Please see the SIGNATURES#deprecations if you encounter a breaking change.


Testing


Changelog

Please see RELEASES for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

FOSSA Status


All versions of typeas with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 smpita/typeas contains the following files

Loading the files please wait ...