Skip to content

Commit 3635ee0

Browse files
committed
2.0.0 pre
1 parent 1272161 commit 3635ee0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+6891
-2713
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
vendor/
2+
.DS_Store
13
.idea

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 lanlin
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+41-29
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,63 @@
1-
# CodeIgniter-Swoole
21

3-
CodeIgniter-Swoole (You need using it within CodeIgniter)
2+
## Codeigniter Swoole Adapter
43

5-
This simple package is combind with CodeIgniter.
4+
This adapter would make it easy to using swoole within Codeigniter framework.
65

7-
So that we can use Swoole in a single CI framework.
6+
With this adapter, you can start a task(CLI) any where(FPM) you want from your code.
87

9-
Normally we only want to start a single server side in CLI,
8+
That's means you can start a CLI task from a FPM process.
109

11-
but connect with multi client side. codeigniter-swoole is the one.
1210

13-
Detail useage see the demo directory, if you formiliar with CI.
14-
15-
# Useage
11+
## Install
1612

17-
Please view the code in demo directory.
13+
```shell
14+
composer require lanlin/codeigniter-swoole
15+
```
1816

19-
The [b]"Swoole.php"[/b] controller
2017

21-
file you must copy into your
18+
## How to
2219

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

25-
Use this package, you can run your CI with nginx, and same time run CI
26-
27-
in CLI. So, you can call the CI run in CLI through fpm, post data to it,
28-
29-
make a long run time possible.
3026

31-
# Require
27+
## What is a task?
28+
A task is just a method of your codeigniter controlloer, so almost any controller method can be used as a task.
3229

33-
Before start the server side, you should make sure has swoole installed
30+
Let's see the code
3431

35-
aready, and of course CI required.
32+
```php
33+
\CiSwoole\Core\Client::send(
34+
[
35+
'route' => 'your/route/uri/to/a/method'
36+
'params' => ['test' => 666]
37+
]);
38+
```
3639

37-
# Command
40+
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.
3841

39-
#------------------------------------------------------------------------------
42+
So, that's all of it!
4043

41-
CLI Command:> cd "to your ci root directory"
4244

43-
CLI Command:> php index.php swoole start // start server from swoole.php
45+
## Server CLI Commands
4446

45-
CLI Command:> php index.php swoole stop // stop server
47+
```shell
4648

47-
CLI Command:> php index.php swoole reload // reload all workers
49+
// start the swoole server
50+
php index.php swoole/server/start
4851

49-
#------------------------------------------------------------------------------
52+
// stop the swoole server
53+
php index.php swoole/server/stop
5054

51-
That's all, @end, sorry about my english.
55+
// reload all wokers of swoole server
56+
php index.php swoole/server/reload
57+
58+
```
59+
60+
61+
## License
62+
63+
This project is licensed under the MIT license.

0 commit comments

Comments
 (0)