Download the PHP package hamlet-framework/type without Composer

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

Hamlet Type

CI Status Packagist Packagist Coverage Status Psalm coverage

There are few aspects of specifying type of expression in PHP:

  1. The most exact specification of the type (we assume it's in psalm syntax): array<int,DateTime|null>
  2. The sequence of run time assertions: assert($records instanceof array<int,DateTime|null>)
  3. The type hint for static analysers (which is psalm at the moment): (array<int,DateTime|null>) $records
  4. The ability to derive types without string manipulation: array<int,DateTime|null> || null
  5. The ability to cast when it's safe, i.e. falsey should cast to false, etc.

This library provides the basic building blocks for type specifications. For example, the following expression:

creates an object of type Type<array<int,DateTime|null>>.

Asserting at run time, that the type of $records is array<int,DateTime|null>>:

Cast $records to array<int,DateTime|null>> and throw an exception when $records cannot be cast to array<int,DateTime|null>>:

Combine type with other types, for example, making it nullable array<int,DateTime|null>>|null:

Object like arrays

Object like arrays require more leg work. For example the type array{id:int,name:string,valid?:bool} corresponds to this construct:

Quite a mouthful. Also, note the required @var as psalm currently have no support for dependent types.

If you want to assert types matching your PHPDoc you can use the type parser (WiP):

Background


All versions of type with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
hamlet-framework/hoa-compiler Version @stable
nikic/php-parser Version ^4
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 hamlet-framework/type contains the following files

Loading the files please wait ....