Download the PHP package nonamephp/php7-common without Composer

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

Build
Status

php7-common

A collection of common libraries for PHP 7.1+.

Installation

Use Composer to install php7-common into your project.

composer require nonamephp/php7-common

Included Libraries

\Noname\Arr

A helper library for working with arrays.

Arr Methods

static flatten(array $array, string $separator = '.') : array

Flatten an associative array using a custom separator. This method will use a dot (.) for $separator by defult.

static dot(array $array) : array

Alias for Arr::flatten() that always uses a dot (.) separator.

static each(array $array, callable $callable) : array

Recursively assign the callable's return value to each array item. Array keys are preserved.

\Noname\Collection

Create a Collection with an associative array to provide helpful methods for working with your data.

Collection implements the following interfaces: Countable, ArrayAccess, IteratorAggregate, Serializable, JsonSerializable

Usage Example

Collection Methods

__construct(array $items = []) : Collection

Creates an instance of Collection. Optionally pass an associative array for $items to prefill the collection with items.

static make(...$arrays) : Collection

Make a collection from one or more arrays.

set(string $key, mixed $value) : void

Add an item to the collection. If $key already exists in the collection it will be overwritten.

get(string|array $key, mixed $default = null) : mixed

Get an item from the collection. Returns $default if item not found.

Passing an array of item keys for the value of $key will result in multiple items being returned as an array. Keys that are missing from the collection will be returned with a value of $default.

has(string $key) : bool

Check if the collection has an item with same $key.

is(string $key, mixed $value, mixed $operater = null) : bool

Compare an item's value against $value. By default, the method will check if the item's value is equal to $value. Optionally, you may supply an $operator to change the comparison logic.

Supported $operator values: =, ==, ===, >, >=, <, <=, <>, !=

Note: = and == are the same, but === is will perform a strict comparison. <> and != are the same.

pluck(string $key, mixed $default = null) : mixed

Pluck an item from the collection. If $key doesn't exist in the collection then $default will be returned.

delete(string $key) : void

Remove an item from the collection.

destroy() : void

Remove all items from the collection.

count() : int

Returns the count of all of the items in the collection.

keys() : array

Returns an array containing the keys of all of the items in the collection.

values() : array

Returns an array containing the values of all of the items in the collection.

all() : array

Alias for toArray().

toArray() : array

Returns an array of all of the items in the collection.

toJson() : string

Returns collection as JSON.

flatten() : array

Flatten all of the items in the collection using dot (.) notation.

\Noname\Str

A helper library for working with strings.

Str Methods

static startsWith(string $string, string $prefix, bool $caseSensitive = true) : bool

Checks if string starts with given prefix. By default this method is case-sensitive.

static endsWith(string $string, string $suffix, bool $caseSensitive = true) : bool

Checks if string ends with given prefix. By default this method is case-sensitive.

static equals(string $a, string $b, bool $caseSensitive = true) : bool

Checks if two strings equal each other. By default this method is case-sensitive.

static contains(string $string, string $search, bool $caseSensitive = true) : bool

Checks if string contains another string. By default this method is case-sensitive.

static toArray(string $string) : array

Splits a string into an array containing each character.

\Noname\Validator

Use Validator to validate your data based on a set of rules.

Usage Example

Built-in Validation Types

Hint: Adding [] to any type (e.g. int[]) will validate an array of values.

Validator Methods

__construct(array $values, array $rules) : Validator

Create an instance of Validator.

addType(string $typeName, array $typeRule) : void

Add a custom validator type. The following example will add a type of equals_2 which validates that the value is equal to 2 and will set an error otherwise.

Note: Custom types must be added prior to calling validate() or an InvalidArgumentException will be thrown.

addValue(string $name, mixed $value) : void

Add value to dataset that is to be validated.

addValues(array $values) : void

Add multiple values to dataset that is to be validated.

values() : array

Returns an array of the values that are set to be validated.

addRule(string $name, mixed $rule) : void

Add a rule to the validator.

addRules(array $rules) : void

Add multiple rules to the validator.

rules() : array

Returns an array of the rules that are set for validation.

validate() : bool

Validate the set data based on the set rules.

hasErrors() : bool

Checks if any errors were set during validation.

getErrors() : array

Returns an array of the errors that were set during validation.

static is(string $type, mixed $value) : bool

Static method to check if $value is valid $type. You can pass any of the built-in validator types for $type.

This method is useful when validating a single value.

static is{Type}(mixed $value) : bool

Similar to is(), except type is passed in the method name.

Note: These methods are case-sensitive. If you are having issues it is recommended that you use is() instead.


All versions of php7-common with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 nonamephp/php7-common contains the following files

Loading the files please wait ....