Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Colada X Laravel Package

alexeyshockov/colada-x

colada-x is a tiny Laravel/PHP helper package by alexeyshockov. Lightweight and experimental, it offers small utilities you can drop into a project quickly. Best for tinkerers who don’t mind minimal docs, few stars, and a still-maturing API.

View on GitHub
Deep Wiki
Context7

\Colada\x()

Helper function for simplify callbacks.

Latest Stable Version Scrutinizer Code Quality Build Status

Installation

$ composer require alexeyshockov/colada-x

Usage

With ColadaX:

$activeUsers = array_filter($users, \Colada\x()->isActive());
$role = 'ADMIN';
$administrators = array_filter($users, \Colada\x()->hasRole($role));

Instead of pure PHP:

$activeUsers = array_filter($users, function ($user) {
    return $user->isActive();
});
$role = 'ADMIN';
$activeUsers = array_filter($users, function ($user) use ($role) {
    return $user->hasRole($role);
});

Useful together

Some code examples for your imagination.

Laravel 5 Collections

$activeUsers = $users->filter(\Colada\x()->isActive());

PHP Collection (schmittjoh/php-collection)

$activeUsers = $users->filter(\Colada\x()->isActive());

functional-php (lstrojny/functional-php)

The library already has partial_method function, but it's less powerful.

use Functional as F;

$activeUsers = F\select($users, \Colada\x()->isActive());

Less useful, but still

Doctrine 2 Collections (Symfony 2, Doctine 2 ORM, etc.)

// __asClosure() is needed because all Doctrine's methods accept only \Closure instances :(
$hasActiveUsers = $users->exists(\Colada\x()->isActive()->__asClosure());

Laravel 4 Collections

The same problem as described above with Doctrine.

Alernatives

If you need only the basic functionaly, take a look at invoke(), invoke_first(), invoke_if(), invoke_last(), invoker() from a great functional-php library.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle