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

Pipeline Laravel Package

sanmai/pipeline

sanmai/pipeline is a lightweight PHP pipeline library to process data through a chain of stages. Compose reusable, testable transformations with clear input/output flow, and plug in custom middleware-like steps for flexible processing in any app.

View on GitHub
Deep Wiki
Context7

Installation

Requirements

Composer Installation

To add the library to your project, run the following Composer command:

composer require sanmai/pipeline

Version Constraints

It is recommended to use a version constraint to ensure your project remains compatible with future releases.

Latest Stable Version (Recommended)

{
    "require": {
        "sanmai/pipeline": "^7.0"
    }
}

Development Version

To use the latest development version, you can require the dev-main branch:

composer require sanmai/pipeline:dev-main

Autoloading

The library follows the PSR-4 autoloading standard. Ensure you include Composer's autoloader in your project's entry point:

require_once 'vendor/autoload.php';

Verifying the Installation

To confirm the library is installed correctly, you can run this simple script:

<?php
require_once 'vendor/autoload.php';

use function Pipeline\take;

$result = take([1, 2, 3, 4, 5])
    ->map(fn($x) => $x * 2)
    ->toList();

print_r($result); // Expected output: [2, 4, 6, 8, 10]

Importing Functions and Classes

The library provides helper functions in the Pipeline namespace. You can import them individually or use their fully qualified names.

// Import individual functions
use function Pipeline\take;
use function Pipeline\map;

// Or use fully qualified names
$pipeline = \Pipeline\take($data);

For direct class usage, import the necessary classes:

use Pipeline\Standard;

$pipeline = new Standard($data);

Development Setup

If you plan to contribute to the library or run its test suite, follow these steps:

  1. Clone the repository:

    git clone https://github.com/sanmai/pipeline.git
    cd pipeline
    
  2. Install dependencies (including dev-dependencies):

    composer install
    
  3. Run the test suite:

    make test
    

Static Analysis

To run static analysis tools like PHPStan and Psalm, first ensure they are installed, then run the analysis command:

composer require --dev phpstan/phpstan vimeo/psalm
make analyze

Troubleshooting

  • Memory Limit Issues: If Composer fails due to memory limits, you can run it with an unlimited memory setting:

    COMPOSER_MEMORY_LIMIT=-1 composer require sanmai/pipeline
    
  • Platform Requirements: Ensure your environment meets the minimum PHP version requirement:

    php -v // Must be 8.2.0 or higher
    
  • Composer Version: If you encounter issues, ensure Composer is up-to-date:

    composer self-update
    

Next Steps

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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation
uri-template/tests