Download the PHP package adbario/php-dot-notation without Composer

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

PHP Dot Notation

Tests Status Coverage Status Total Downloads Latest Stable Version

About Dot

Dot provides an easy access to arrays of data with dot notation in a lightweight and fast way. Inspired by Laravel Collection.

Dot implements PHP's ArrayAccess interface and Dot object can also be used the same way as normal arrays with additional dot notation.

Examples

With Dot you can change this regular array syntax:

to this (Dot object):

or even this (ArrayAccess):

Install

Install the latest version using Composer:

Usage

Create a new Dot object:

You can also use a helper function to create the object:

All methods not returning a specific value returns the Dot object for chaining:

Methods

Dot has the following methods:

add()

Sets a given key / value pair if the key doesn't exist already:

Multiple key / value pairs:

all()

Returns all the stored items as an array:

clear()

Deletes the contents of a given key (sets an empty array):

Multiple keys:

All the stored items:

count()

Returns the number of items in a given key:

Items in the root of Dot object:

delete()

Deletes the given key:

Multiple keys:

flatten()

Returns a flattened array with the keys delimited by a given character (default "."):

get()

Returns the value of a given key:

Returns a given default value, if the given key doesn't exist:

has()

Checks if a given key exists (returns boolean true or false):

Multiple keys:

isEmpty()

Checks if a given key is empty (returns boolean true or false):

Multiple keys:

Checks the whole Dot object:

merge()

Merges a given array or another Dot object:

Merges a given array or another Dot object with the given key:

mergeRecursive()

Recursively merges a given array or another Dot object:

Recursively merges a given array or another Dot object with the given key:

mergeRecursiveDistinct()

Recursively merges a given array or another Dot object. Duplicate keys overwrite the value in the original array (unlike mergeRecursive(), where duplicate keys are transformed into arrays with multiple values):

Recursively merges a given array or another Dot object with the given key. Duplicate keys overwrite the value in the original array.

pull()

Returns the value of a given key and deletes the key:

Returns a given default value, if the given key doesn't exist:

Returns all the stored items as an array and clears the Dot object:

push()

Pushes a given value to the end of the array in a given key:

Pushes a given value to the end of the array:

replace()

Replaces the values with values having the same keys in the given array or Dot object:

Replaces the values with values having the same keys in the given array or Dot object with the given key:

replace() is not recursive.

set()

Sets a given key / value pair:

Multiple key / value pairs:

setArray()

Replaces all items in Dot object with a given array:

setReference()

Replaces all items in Dot object with a given array as a reference and all future changes to Dot will be made directly to the original array:

toJson()

Returns the value of a given key as JSON:

Returns all the stored items as JSON:

Contributing

Pull Requests

  1. Fork the Dot repository
  2. Create a new branch for each feature or improvement
  3. Send a pull request from each feature branch to the 3.x branch

It is very important to separate new features or improvements into separate feature branches, and to send a pull request for each branch. This allows me to review and pull in new features or improvements individually.

Style Guide

All pull requests must adhere to the PSR-12 standard.

Unit Testing

All pull requests must be accompanied by passing unit tests and complete code coverage. Dot uses PHPUnit for testing.

Static Analysis

All pull requests must pass static analysis using PHPStan.

License

MIT license


All versions of php-dot-notation with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-json Version *
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 adbario/php-dot-notation contains the following files

Loading the files please wait ....