PHPackages                             mdzzohrabi/azera-queryable - 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. mdzzohrabi/azera-queryable

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

mdzzohrabi/azera-queryable
==========================

Azera Queryable Component

1.1(10y ago)0841MITPHPPHP &gt;=5.3

Since Aug 29Pushed 9y ago1 watchersCompare

[ Source](https://github.com/mdzzohrabi/Azera-Queryable)[ Packagist](https://packagist.org/packages/mdzzohrabi/azera-queryable)[ RSS](/packages/mdzzohrabi-azera-queryable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Azera Queryable [![Travis](https://camo.githubusercontent.com/cbde6685a70bf878a9a26dfe61f012f21ded1cfe53ed5af701b604ff65037ee5/68747470733a2f2f7472617669732d63692e6f72672f6d647a7a6f68726162692f417a6572612d517565727961626c652e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/cbde6685a70bf878a9a26dfe61f012f21ded1cfe53ed5af701b604ff65037ee5/68747470733a2f2f7472617669732d63692e6f72672f6d647a7a6f68726162692f417a6572612d517565727961626c652e7376673f6272616e63683d6d6173746572)
===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#azera-queryable-)

---

**Samples :**

```
// Sum
(new Queryable( [ 20 , 30 , 60 ] ))->Sum(); // Return 110
(new Queryable( [ 20 , 30 , 60 ] ))->Sum('x => x + 10'); // Return 140

// Average
(new Queryable( [ 50 , 100 ] ))->Average(); // Return 75
(new Queryable( [ 50 , 100 ] ))->Average('x => x * 2'); // Return 150

// Max
(new Queryable( range(20,100) ))->Max(); // Return 100

// Min
(new Queryable( range(20,100) ))->Min(); // Return 20

// Any
(new Queryable( [ [ 'Red','Blue' ] , [ 'Green' ] ] ))->Any('colors => in_array( "Red" , colors )'); // Return true
(new Queryable( [ [ 'Red','Blue' ] , [ 'Green' ] ] ))->Any('colors => in_array( "White" , colors )'); // Return false

// Where
(new Queryable( [ 10 , 30 , 50 ] ))->Where('x => x > 10'); // Return Queryable( [ 30 , 50 ] )

$users = array(
	[
		'id' => 10,
		'name' => 'Masoud',
		'rule' => 'Admin'
	],
	[
		'id' => 15,
		'name' => 'Alireza',
		'rule' => 'User'
	]
);

// Select
(new Queryable( $users ))->Select('user => user["name"]'); // Return Queryable( [ 'Masoud' , 'Alireza' ] )

// Last
(new Queryable( $users ))->Select('user => user["name"]')->Last(); // Return "Alireza"

// First
(new Queryable( $users ))->Select('user => user["id"]')->First(); // Return 10

// Cast
(new Queryable( $users ))->Cast('object')->Select('user => user->name')->Last(); // Return "Alireza"

// Contains
(new Queryable( [20 , 30 , 40] ))->Contains(30); // Return true

// Except
(new Queryable( [20 , 30 , 40] ))->Except([20]); // Return Queryable([ 30 , 40 ])

// Distinct
(new Queryable([ 20 , 20 , 40 , 50 ]))->Distinct(); // Return Queryable([ 20 , 40 , 50 ])

// Concat
(new Queryable([ 2 , 3 ]))->Concat([4 , 5]); // Return Queryable([ 2 , 3 , 4 , 5 ])

// Skip
(new Queryable( range( 1 , 100 ) ))->Skip(50)->First(); // Return 51

// Intersect
(new Queryable( range( 1 , 10 ) ))->Intersect( range(5,8) ); // Return Queryable( [1,2,3,4,9,10] )

// ElementAt
(new Queryable( range(1,100) ))->ElementAt(90); // Return 91

// toArray
(new Queryable( range(1,10) ))->toArray(); // Return [ 1,2,3,4,5,6,7,8,9,10]

// insert
(new Queryable)->insert( 80 );

// insertBulk
(new Queryable)->insertBulk( [ 80 , 90 , 100 ] );

// deleteElementAt
(new Queryable)->insertBulk( [ 80 , 90 , 100 ] )->deleteElementAt(1); // Return Queryable( [ 80 , 100 ] )
```

### ArrayAccess

[](#arrayaccess)

```
$books = new Queryable;

$books->insert( [ 'name' => 'Alice in wonderland' ] );
$books->insert( [ 'name' => 'LEGO Story' ] );

// Will return "Alice in wonderland"
print( $books[0]['name'] );
```

### Interator

[](#interator)

```
$users = new Queryable;

$users->insertMany( array( [ 'name' => 'Alireza' ] , [ 'name' => 'Masoud' ] ) );

foreach ( $users as $user )
	printf("Name : %s\n" , $user['name']);

// Output :
// Name : Alireza
// Name : Masoud
```

### SubNodes Quick Access

[](#subnodes-quick-access)

Sample #1

```
$users = new Queryable;

$users->insert( array( 'name' => 'Masoud' , 'rule' => 'Admin' ) );

$users->insert( array( 'name' => 'Mohsen' , 'rule' => 'User' ) );

print $users->get('1.name'); // returns 'Mohsen'
```

Sample #2

```
$configurations = new Queryable( App::readAllConfigurations() );

print $configurations
			->getAsQueryable('modules')
			->Where('module => module->name == "search"')
			->get('active'); // returns activation state of search module
```

### Some Usages

[](#some-usages)

#### Find books of specified author

[](#find-books-of-specified-author)

```
$books = new Queryable;

// Read books from stored json file
$books->insertMany( json_decode( file_get_contents('books.json') ));

// Print list of books authored by 'Leo Tolstoy'
$author = 'Leo Tolstoy';
print_r(
	$books
		->Where("book => book->author == $author")
		->toArray()
	);
```

#### Get specified property of books ( in this case 'Name' )

[](#get-specified-property-of-books--in-this-case-name-)

```
/**
 * Books json scheme :
 * [
 *    {
 *       'name' : 'Alice in wonder land',
 *       'price': '15$'
 *    },
 *    {
 *       'name' : 'LEGO Story',
 *       'price' : '35$'
 *    }
 * ]
 **/
$books = new Queryable( Json::readFromFile('books.json') );

// returns only names of books
print_r(
	$books
		->Select('book => book->name')
		->toArray()
);
```

#### Have any active modules ?

[](#have-any-active-modules-)

```
$modules = new Queryable( App::getModules() );

$any = $modules->Any('module => module->active');// Returns true of false
```

#### Get modules controllers

[](#get-modules-controllers)

```
$modules = new Queryable( App::getModules() );

$controllers = $modules
				->Where('module => module->active')
				->Select('module => module->controllers');
```

Class Abstract
==============

[](#class-abstract)

```
namespace Azera\Component;

class Queryable implements Iterator, ArrayAccess
{
	// Methods...
}
```

Install
=======

[](#install)

### by Composer

[](#by-composer)

```
composer require mdzzohrabi/Azera-Queryable:dev-master

```

### Manually

[](#manually)

- Download zip file github
- Extract zip to your project
- Include "autoload.php.dist" or create your autoloader manually
- Enjoy it !

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3908d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1e9dc6a94dcc84191bcc65e590d2ffabd3b4aa66eedfb3e57c6beb4c5ceb6bf?d=identicon)[mdzzohrabi](/maintainers/mdzzohrabi)

---

Top Contributors

[![mdzzohrabi](https://avatars.githubusercontent.com/u/1908730?v=4)](https://github.com/mdzzohrabi "mdzzohrabi (29 commits)")

---

Tags

enumerablecomponentazeraqueryable

### Embed Badge

![Health badge](/badges/mdzzohrabi-azera-queryable/health.svg)

```
[![Health](https://phpackages.com/badges/mdzzohrabi-azera-queryable/health.svg)](https://phpackages.com/packages/mdzzohrabi-azera-queryable)
```

###  Alternatives

[spatie/enum

PHP Enums

84429.1M68](/packages/spatie-enum)[phpoffice/common

PHPOffice Common

23512.3M36](/packages/phpoffice-common)[lochmueller/autoloader

Automatic components loading of ExtBase extensions to get more time for coffee in the company ;) This ext is not a PHP SPL autoloader or class loader - it is better! Loads CommandController, Xclass, Hooks, FlexForms, Slots, TypoScript, TypeConverter, BackendLayouts and take care of createing needed templates, TCA configuration or translations at the right location.

19364.9k5](/packages/lochmueller-autoloader)[tomatophp/filament-icons

Picker &amp; Table Column &amp; Icons Provider for FilamentPHP

3598.2k13](/packages/tomatophp-filament-icons)[contributte/menu-control

Menu control for Nette framework

29108.6k1](/packages/contributte-menu-control)[carrooi/nette-menu

Menu control for Nette framework

2950.0k1](/packages/carrooi-nette-menu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
