Download the PHP package cedriccourteau/variant without Composer

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

Variant

A simple ValueObject and ResultType generator for PHP

About The Project

Creating Value Objects or Result Types in PHP can be time-consuming compared to creating custom types in other languages. Variant aims to simplify this process by providing a custom, easy-to-use language for prototyping them.

Here's an example of how a type can be generated with Variant:

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Installation

Usage

  1. Add a file with the .variant extension the desired folder, such as src/Users/Types/users.variant
  2. Define your types in this file
  3. Launch php ./vendor/bin/variant
  4. Voilà

Syntax of .variant files

Overview

Available instructions

record

Hold a single ValueObject with custom constructor. Everything between the parenthesis are like in php but without the $ for param declaration.

type

It encapsulates records into a global type, translated into a Interface. Between the {} you add custom variants for this type

result

Create a custom Result type with an Ok value and an Error type.

If the ERROR_TYPE is a defined type in the current .variant file, it binds the type to a type union of all of its variants.

Example:

Cli options

Contributing

Contributions are welcome! Feel free to fork, use, and improve the project.

License

Distributed under the MIT License. Fork it, use it, make it better.


All versions of variant with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 cedriccourteau/variant contains the following files

Loading the files please wait ....