PHPackages                             mascame/arrayer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mascame/arrayer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mascame/arrayer
===============

Array manipulation with dot notation. Also prepares an array to be put in a file. Very useful for config files.

3.4.0(9y ago)141.4k12MITPHPPHP &gt;=5.4.0

Since Nov 22Pushed 9y ago3 watchersCompare

[ Source](https://github.com/marcmascarell/arrayer)[ Packagist](https://packagist.org/packages/mascame/arrayer)[ Docs](https://github.com/marcmascarell/arrayer)[ RSS](/packages/mascame-arrayer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (10)Used By (2)

Arrayer
=======

[](#arrayer)

[![Packagist](https://camo.githubusercontent.com/d2d70d7fbc68dba3b24b9046f62705ae5759765bf78113775088416ccaabb84b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617363616d652f617272617965722e7376673f6d61784167653d323539323030303f7374796c653d706c6173746963)](https://packagist.org/packages/mascame/arrayer)[![Travis](https://camo.githubusercontent.com/905c168e840d5e7feec4c6dfa0ad30f565cb6f8d8c760f99f8c62e993fae9e74/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d6172636d6173636172656c6c2f617272617965722e7376673f6d61784167653d323539323030303f7374796c653d706c6173746963)](https://travis-ci.org/marcmascarell/arrayer)[![license](https://camo.githubusercontent.com/59a0f7539d1132da5631a91d6e6e1bcdd5ef259de5d155e55ff826aa0a73db4e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6172636d6173636172656c6c2f617272617965722e7376673f6d61784167653d323539323030303f7374796c653d706c6173746963)](https://github.com/marcmascarell/arrayer)

Array manipulation. Get, set &amp; delete keys with dot notation, also prepares an array to be put in a file (php array or json).

Installation
------------

[](#installation)

Require this package in your composer.json and run composer update:

`composer require mascame/arrayer`

Usage
-----

[](#usage)

```
$array = array(

	'this' => array(
		'is' => 'an',
		'example'
	),

	'we use a' => 'normal array',

	'and manipulate it' => array(
		'as' => array(
			'we' => array(
				'want' => ':D'
			)
		)
	),

	'thats it',
	'cool? :)'

);

$arrayer = new \Mascame\Arrayer\Arrayer($array);

$arrayer->set('we.use.dot.notation', array('so', 'cool.'));

$arrayer->set('this.is', 'we gonna delete this very soon...');
$arrayer->delete('this.is');

$arrayer->set('more.examples', 'test');
$arrayer->get('more.examples'); // returns 'test'

$arrayer->getArray(); // returns the modified array
```

Build a prepared output for file (This example uses Laravel's "File" class to put file contents):

```
/**
*   Available options for ArrayBuilder
*    [
*        'oldSyntax' => false, // use old array syntax
*        'minify' => false,
*        'indexes' => true, // Show the incremental indexes (array keys)
*        'startWithScript' => true, // start with
