Download the PHP package maarky/singlecontainer without Composer

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

Single Container

SingleContainer is an interface for creating monads. The idea is that you can create a container that wraps a single value, or no value, and then perform actions on that value and create new monads containing that value or the result of an action performed on that value.

Although it doesn't have to be implemented this way, the idea is that a SingleContainer should expect values of specific types. For example, one type of SingleContainer might only contain strings. This provides type safety, allowing you to apply functions with the confidence that the function is able to operate on the type of value stored in the container.

Documentation

A number of these methods take callables as their argument. These methods come in two types: those whose container does hold a value, and those whose container holds no value. On those methods which do expect a container to have a value the callable must always take that value as the first and only required argument. On those methods which do not expect a container to have a value the callable can optionally take the container as its only argument. The reason the container is passed to the callables is because it is possible the container might have additional information. For example, if the container has no value then the callable might want to know what type of container is calling it in order to provide context on what it should do.

Methods that expect a container to have a value are map(), flatmap(), filter(), filternot(), and foreach().

Methods that expect a container to have no value are getOrCall(), orCall(), and fornothing().

get()

Retrieves the container value. Must throw a Type error if the container has no value.

getOrElse($else)

Retrieves the container value, or $else if the container has no value. Must throw a Type error if the container has no value and $else is a different type than what the container should have. In other words, if the container is meant to store strings then $else must be a string.

getOrCall(callable $call)

Retrieves the container value, or calls $call if the container has no value and returns the result. Must throw a Type error if the container has no value and $call returns a different type than what the container should have. In other words, if the container is meant to store strings then $call must return a string.

$call should have signature function(SingleContainer $container): mixed where $container is the calling SingleContainer and mixed is the same datatype that should be stored in the container.

orElse(SingleContainer $else)

Returns container if the container has a value, otherwise returns $else.

orCall(callable $call): SingleContainer

Returns container if the container has a value, otherwise calls $call and returns its value.

$call should have signature function(SingleContainer $container): SingleContainer where $container is the calling SingleContainer.

isDefined(): bool

Returns true if container has value, otherwise false.

isEmpty(): bool

Returns false if container has value, otherwise true.

filter(callable $filter): SingleContainer

Calls filter passing in the container value. Returns itself if filter returns true, otherwise an empty container of the same type. If this method is called on an empty container there is nothing to filter so it should ignore $filter and return itself.

$filter should have signature function(mixed $var): boolean where $var is the data being stored in the calling SingleContainer.

filterNot(callable $filter): SingleContainer

The inverse of the filter() method. It should return itself if $filter returns false, otherwise it should return an empty container.

map(callable $map): SingleContainer

If container has a value it should call $map, passing in the value. $map should return a value to be wrapped inside a SingleContainer. If $map returns a SingleContainer it should be wrapped inside another SingleContainer. If $map returns an empty value it should return an empty SingleContainer. If the calling container has no value it should ignore $map and return itself.

$map should have signature function(mixed $var): mixed where $var is the data being stored in the calling SingleContainer.

flatMap(callable $map): SingleContainer

If container has a value it should call $map, passing in the value. $map must return any type of SingleContainer. If container has no value it should ignore $map and return itself.

$map Should have signature function(mixed $var): SingleContainer where $var is the data being stored in the calling SingleContainer.

foreach(callable $each): SingleContainer

If container has a value it calls $each and does nothing with the result. Then returns itself. If container has no value it ignores $each and returns itself.

This method is meant to be used when you want to produce side effects, not when you want to alter the container value.

$each should have signature function(mixed $var): void where $var is the data being stored in the calling SingleContainer.

fornothing(callable $nothing): SingleContainer

If container has a value it ignores $nothing and returns itself. If container has no value it calls $nothing and does nothing with the result. Then returns itself.

This method is meant to be used when you want to produce side effects.

$nothing should have signature function(SingleContainer $container): void where $container is the calling SingleContainer.

equals($value): bool

Determines if two containers are equal. They must be the same container class. They must also have the same value, or they must both be empty.


All versions of singlecontainer 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 maarky/singlecontainer contains the following files

Loading the files please wait ....