PHPackages                             crojasaragonez/light-service - 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. crojasaragonez/light-service

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

crojasaragonez/light-service
============================

Php port for https://github.com/adomokos/light-service

2.1.0(6mo ago)02.3k↑14.3%1MITPHPPHP &gt;=8.2

Since Feb 28Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/crojasaragonez/light-service)[ Packagist](https://packagist.org/packages/crojasaragonez/light-service)[ Docs](https://github.com/crojasaragonez/light-service)[ RSS](/packages/crojasaragonez-light-service/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (2)Versions (8)Used By (0)

LightService
============

[](#lightservice)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3f00985d96819c2ee498f7172cfbf886cbcf65e500cbab9d5f0adb87b4677d4b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63726f6a6173617261676f6e657a2f6c696768742d736572766963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/crojasaragonez/light-service)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/a0c01d436959f2351c31e7bdc29f27a4545ec6ffa5c8ab0ae527291277ecf7a6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f63726f6a6173617261676f6e657a2f6c696768742d736572766963652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/crojasaragonez/light-service)[![Coverage Status](https://camo.githubusercontent.com/58930df82ed439eca4f48d6a4c0914e4df97285773606f2e8099784a879563f1/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f63726f6a6173617261676f6e657a2f6c696768742d736572766963652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/crojasaragonez/light-service/code-structure)[![Quality Score](https://camo.githubusercontent.com/afe596d32be703928a923e5b7927069dd290285d8092de6bde25d08a922e4973/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f63726f6a6173617261676f6e657a2f6c696768742d736572766963652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/crojasaragonez/light-service)[![Total Downloads](https://camo.githubusercontent.com/48aad09a4f21450002e88ddddd4002cf4e1a4591042cfbf862b9865e3a639318/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63726f6a6173617261676f6e657a2f6c696768742d736572766963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/crojasaragonez/light-service)

Php port for

Install
-------

[](#install)

Via Composer

```
$ composer require crojasaragonez/light-service
```

Usage
-----

[](#usage)

```
require_once 'vendor/autoload.php';

use crojasaragonez\LightService\Action;
use crojasaragonez\LightService\Organizer;

class CreateTmpFile extends Action
{
    public $promises = ['file_path'];
    public function execute()
    {
        $this->context['file_path'] = tempnam(sys_get_temp_dir(), 'img_') . '.png';
    }
}

class Download extends Action
{
    public $expects  = ['url', 'file_path'];
    public function execute()
    {
        if (!@file_put_contents($this->context['file_path'], file_get_contents($this->context['url']))) {
            $this->skipRemaining();
        }
    }
}

class ZipFile extends Action
{
    public $expects  = ['file_path'];
    public $promises = ['zip_path'];
    public function execute()
    {
        $zip_path = str_replace('.png', '.zip', $this->context['file_path']);
        $zip = new ZipArchive();
        $zip->open($zip_path, ZipArchive::CREATE);
        $zip->addFile($this->context['file_path'], basename($this->context['file_path']));
        $zip->close();
        $this->context['zip_path'] = $zip_path;
    }
}

$organizer = new Organizer(['url' => 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/PHP-logo.svg/100px-PHP-logo.svg.png']);
$result = $organizer->reduce([
  CreateTmpFile::class,
  Download::class,
  ZipFile::class
]);

print_r($result);
```

### Progress Tracking

[](#progress-tracking)

You can track the progress of action execution by passing a callback to `reduce()`:

```
$organizer = new Organizer(['url' => 'https://example.com/image.png']);
$result = $organizer->reduce([
  CreateTmpFile::class,
  Download::class,
  ZipFile::class
], function(int $current, int $total, string $action, bool $skipped) {
    echo "[{$current}/{$total}] {$action}" . ($skipped ? ' (skipped)' : '') . "\n";
});
```

The callback receives:

- `$current` - Number of actions processed so far (1-indexed)
- `$total` - Total number of actions
- `$action` - The class name of the action just processed
- `$skipped` - Whether the action was skipped (due to `skipRemaining()`)

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Carlos Luis Rojas Aragonés](https://github.com/crojasaragonez)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance68

Regular maintenance activity

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity78

Established project with proven stability

 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

Every ~416 days

Recently: every ~622 days

Total

7

Last Release

186d ago

Major Versions

v1.0.4 → v2.0.02025-12-30

PHP version history (3 changes)1.0.0PHP ~7.1

1.0.1PHP &gt;=7.0.10

v2.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b99274714cf92de1afa615f38fb9695c5131826fffb3df45cb5b5f8767ff925?d=identicon)[crojasaragonez](/maintainers/crojasaragonez)

---

Top Contributors

[![crojasaragonez](https://avatars.githubusercontent.com/u/4663192?v=4)](https://github.com/crojasaragonez "crojasaragonez (15 commits)")

---

Tags

crojasaragonezLightService

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/crojasaragonez-light-service/health.svg)

```
[![Health](https://phpackages.com/badges/crojasaragonez-light-service/health.svg)](https://phpackages.com/packages/crojasaragonez-light-service)
```

###  Alternatives

[desandro/imagesloaded

JavaScript is all like \_You images done yet or what?\_

8.9k449.7k1](/packages/desandro-imagesloaded)[rappasoft/laravel-livewire-tables

A dynamic table component for Laravel Livewire

2.0k2.9M31](/packages/rappasoft-laravel-livewire-tables)[szeidler/composer-patches-cli

28259.3k4](/packages/szeidler-composer-patches-cli)[wa72/html-pretty-min

HTML minifier and indenter that works on the DOM tree

22231.3k8](/packages/wa72-html-pretty-min)[veewee/reflecta

Unleash the Power of Optics in your code!

13422.0k7](/packages/veewee-reflecta)[apen/additional_reports

Useful information in the reports module : xclass, ajax, cliKeys, eID, general status of the system (encoding, DB, php vars...), hooks, compare local and TER extension (diff), used content type, used plugins, ExtDirect... It can really help you during migration or new existing project (to have a global reports of the system).

14167.3k](/packages/apen-additional-reports)

PHPackages © 2026

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