Download the PHP package khalyomede/monad without Composer

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

khalyomede/monad

Maybe, Option and Result monads for PHP.

Summary

About

I published on reddit an RFC proposal for what I called "enums constructor" (which happened to be an existing concept called "tagged unions"). Out of one comment, I shown how to chain calls to various ADT outcomes, in order to reduces pyramidal matches.

This got me into wanting to use more monads right now on my next projects. After searching on packagist.org, I did not found something that fits what I expected, so I decided to make my own version of how I think monads should look like in PHP.

Features

Prerequisites

Installation

Examples

1. Getting a file content

In this example, we will use the Maybe monad as result, and use it in our main code.

2. Get users from an SQL table

In this example, we will use the Result monad to return the list of users or an error from PDO.

3. Chain multiple outcomes

In this example, we will chain multiple times "then", similar to what is possible in other languages through "map".

If you remove the file, the result becomes

If you remove the write permission on this file, the result becomes

API

For a list of all possible functions, see the tests\unit folder.

Tests


All versions of monad with dependencies

PHP Build Version
Package Version
Requires webmozart/assert 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 khalyomede/monad contains the following files

Loading the files please wait ....