PHPackages                             frenzzy-ekb/codeigniter-swoole - 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. [Framework](/categories/framework)
4. /
5. frenzzy-ekb/codeigniter-swoole

ActiveLibrary[Framework](/categories/framework)

frenzzy-ekb/codeigniter-swoole
==============================

A swoole adapter for Codeigniter 3.0+

2.1.2(6y ago)015MITPHPPHP &gt;=7.0

Since Oct 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/frenzzy-ekb/codeigniter-swoole)[ Packagist](https://packagist.org/packages/frenzzy-ekb/codeigniter-swoole)[ Docs](https://github.com/frenzzy-ekb/codeigniter-swoole)[ RSS](/packages/frenzzy-ekb-codeigniter-swoole/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (20)Used By (0)

Codeigniter Swoole Adapter
--------------------------

[](#codeigniter-swoole-adapter)

You want long-run task? timers? FPM to CLI? Code reusing in both FPM &amp; CLI mode?

"It's so easy!"

This adapter would make it so easy to using swoole within Codeigniter framework.

With this adapter, you can start a task(CLI) any where(FPM) you want from your code.

That's means you can start a CLI task from a FPM process.

Install
-------

[](#install)

```
composer require lanlin/codeigniter-swoole

```

How to
------

[](#how-to)

1. first, of course you must install `codeigniter-swoole` to your codeigniter project.
2. (this step is option) copy these two config files `swoole.php` and `timers.php` from `src/Helper` to your `application/config` folder.
3. start swoole server `php index.php swoole/server/start`
4. you can use `\CiSwoole\Core\Client::send($data)` to start a task now!
5. there's no step 5.

What is a task?
---------------

[](#what-is-a-task)

A task is just a method of your codeigniter controlloer, so almost any controller method can be used as a task.

Let's see the code

```
\CiSwoole\Core\Client::send(
[
    'route'  => 'your/route/uri/to/a/method'
    'params' => ['test' => 666]
], $fd, $callback);

```

The `route` is used for find which method to be call as a task, and `params` is the parameters array that you may want to pass to the task.

`fd` and `callback` params are used to notify about task errors.

So, that's all of it!

Server CLI Commands
-------------------

[](#server-cli-commands)

```

// start the swoole server
php index.php swoole/server/start

// stop the swoole server
php index.php swoole/server/stop

// reload all wokers of swoole server
php index.php swoole/server/reload

```

A little more
-------------

[](#a-little-more)

The step 2 copied files were config files for this adapter.

`swoole.php` file can set host, port, log file and so on.

`timers.php` file can set some timer methods for swoole server, these timers will be started once the server inited.

You can copy `tests/application` to your `application` for testing. The demos are same as below shows.

```
class Test extends CI_Controller
{

    // ------------------------------------------------------------------------------

    /**
     * here's the task 'tests/test/task'
     */
    public function task()
    {
        $data = $this->input->post();     // as you see, params worked like normally post data

        log_message('info', var_export($data, true));
    }

    // ------------------------------------------------------------------------------

    /**
     * here's the timer method
     *
     * you should copay timers.php to your config folder,
     * then add $timers['tests/test/task_timer'] = 10000; and start the swoole server.
     *
     * this method would be called every 10 seconds per time.
     */
    public function task_timer()
    {
        log_message('info', 'timer works!');
    }

    // ------------------------------------------------------------------------------

    /**
     * send data to task
     */
    public function send()
    {
        try
        {
            \CiSwoole\Core\Client::send(
            [
                'route'  => 'tests/test/task',
                'params' => ['hope' => 'it works!'],
            ]);
        }
        catch (\Exception $e)
        {
            log_message('error', $e->getMessage());
            log_message('error', $e->getTraceAsString());
        }
    }

    // ------------------------------------------------------------------------------

}

```

License
-------

[](#license)

This project is licensed under the MIT license.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 86.1% 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 ~89 days

Recently: every ~133 days

Total

19

Last Release

2251d ago

Major Versions

1.2.0 → 2.0.02018-07-01

PHP version history (3 changes)1.0.0PHP &gt;=5.4.0

2.0.0PHP &gt;=5.6

2.1.2PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4416157333639dc85cb8728b07a3c31da22334b5141e9b56dd1718fcb1a99b02?d=identicon)[frenzzy](/maintainers/frenzzy)

---

Top Contributors

[![lanlin](https://avatars.githubusercontent.com/u/3468024?v=4)](https://github.com/lanlin "lanlin (31 commits)")[![frenzzy-ekb](https://avatars.githubusercontent.com/u/2919964?v=4)](https://github.com/frenzzy-ekb "frenzzy-ekb (5 commits)")

---

Tags

phpcodeigniteradapterswooletasktimersLong Run

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/frenzzy-ekb-codeigniter-swoole/health.svg)

```
[![Health](https://phpackages.com/badges/frenzzy-ekb-codeigniter-swoole/health.svg)](https://phpackages.com/packages/frenzzy-ekb-codeigniter-swoole)
```

###  Alternatives

[hyperf/hyperf-skeleton

A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.

301187.4k](/packages/hyperf-hyperf-skeleton)

PHPackages © 2026

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