PHPackages                             nguyenanhung/codeigniter3-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nguyenanhung/codeigniter3-swoole

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

nguyenanhung/codeigniter3-swoole
================================

Swoole Adapter for CodeIgniter v3 Framework - Basic, Simple and Lightweight

v1.0.1(3y ago)12MITPHPPHP &gt;=7.3.0

Since Jul 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nguyenanhung/codeigniter3-swoole)[ Packagist](https://packagist.org/packages/nguyenanhung/codeigniter3-swoole)[ Docs](https://github.com/nguyenanhung/codeigniter3-swoole)[ RSS](/packages/nguyenanhung-codeigniter3-swoole/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/eb13afe3a48f1ddb0ee95e24f5c0b1fcf664bac7a47db81fee17b47aa459eac5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e677579656e616e68756e672f636f646569676e69746572332d73776f6f6c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nguyenanhung/codeigniter3-swoole)[![Total Downloads](https://camo.githubusercontent.com/0fc91a3f8ee7e4fd8eca393c54ed31426c702ac9f085995624d5b23bd8dc8453/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e677579656e616e68756e672f636f646569676e69746572332d73776f6f6c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nguyenanhung/codeigniter3-swoole)[![License](https://camo.githubusercontent.com/ef5f1348e8c24a5d59c7d28b21b1b55e0ce04945fdf4e98eb529f0c98e73310a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e677579656e616e68756e672f636f646569676e69746572332d73776f6f6c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nguyenanhung/codeigniter3-swoole)[![PHP Version Require](https://camo.githubusercontent.com/0e101bfb801251c2d4076ba0fa1e6da7c4b94d0345264cf8759360d0f9dc4da6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6e677579656e616e68756e672f636f646569676e69746572332d73776f6f6c652f706870)](https://packagist.org/packages/nguyenanhung/codeigniter3-swoole)

Swoole Adapter for CodeIgniter v3 Framework
===========================================

[](#swoole-adapter-for-codeigniter-v3-framework)

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) anywhere (FPM) you want from your code.

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

Install
-------

[](#install)

```
composer require nguyenanhung/codeigniter3-swoole
```

How to
------

[](#how-to)

1. first, of course you must install `codeigniter3-swoole` to your codeigniter project.
2. (this step is option) copy these two config files `swoole.php` and `timers.php` from `config` to your `app/config` folder.
3. start swoole server `php index.php swoole/server/start`
4. you can use `\nguyenanhung\CodeIgniter\Swoole\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

```
\nguyenanhung\CodeIgniter\Swoole\Core\Client::send(
[
    'route'  => 'your/route/uri/to/a/method'
    'params' => ['test' => 666]
]);
```

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.

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.

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
        {
            \nguyenanhung\CodeIgniter\Swoole\Core\Client::send(
            [
                'route'  => 'tests/test/task',
                'params' => ['hope' => 'it works!'],
            ]);
        }
        catch (\Exception $e)
        {
            log_message('error', $e->getMessage());
            log_message('error', $e->getTraceAsString());
        }
    }

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

}
```

Contact &amp; Support
---------------------

[](#contact--support)

If any question &amp; request, please contact following information

NameEmailSkypeFacebookHung Nguyennguyenanhung5891@nguyenanhungFrom Vietnam with Love &lt;3

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~0 days

Total

2

Last Release

1384d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3694ef9f3367ff9f6bcd668ca1d6726e3c55e6fd379cba9c2d4ab6a24595fbd8?d=identicon)[7135k13m](/maintainers/7135k13m)

---

Top Contributors

[![hungnguyenhp](https://avatars.githubusercontent.com/u/6778496?v=4)](https://github.com/hungnguyenhp "hungnguyenhp (3 commits)")[![nguyenanhung](https://avatars.githubusercontent.com/u/9348255?v=4)](https://github.com/nguyenanhung "nguyenanhung (2 commits)")

---

Tags

phphelperlibraryswoole

### Embed Badge

![Health badge](/badges/nguyenanhung-codeigniter3-swoole/health.svg)

```
[![Health](https://phpackages.com/badges/nguyenanhung-codeigniter3-swoole/health.svg)](https://phpackages.com/packages/nguyenanhung-codeigniter3-swoole)
```

###  Alternatives

[nguyenanhung/codeigniter-basic-helper

CodeIgniter - Basic Helper

1027.3k1](/packages/nguyenanhung-codeigniter-basic-helper)

PHPackages © 2026

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