luoxiaojun / sw-fw-less
Swoole Http Server without framework
Installs: 4 906
Dependents: 1
Suggesters: 0
Security: 0
Stars: 17
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: >=7.1
- ext-json: *
- ext-swoole: >=4.4.0
- aura/sqlquery: ^2
- bt51/ntp: ~0.1.0
- cakephp/event: ~3.7.1|~4
- cakephp/validation: ~3|~4
- dragonmantank/cron-expression: ^2.3
- filp/whoops: ~2.1@stable
- league/flysystem: ~1
- luoxiaojun/closure-php: dev-main
- luoxiaojun/grpc: dev-master
- luoxiaojun1992/monolog-co-stream-handler: ~1.0
- monolog/monolog: ^1
- nesbot/carbon: ^1.26.3|^2.0
- nikic/fast-route: ^1
- opis/closure: ^3.3
- php-di/php-di: ~6.0
- psy/psysh: ~0.10.4
- ramsey/uuid: ~3
- swlib/saber: ^1
- symfony/console: ~3.3.0|~5.3.0
- symfony/polyfill-php80: ~1.23.1
- vlucas/phpdotenv: ~2.2
Requires (Dev)
- mockery/mockery: ~1.2
- phpunit/phpunit: ~7.5|~8.1
Suggests
- ext-curl: *
- ext-jsonnet: *
- ext-pdo: *
- ext-phalcon: *
- ext-redis: *
- ext-smbclient: *
- apache/thrift: 0.11.0
- elasticsearch/elasticsearch: ~6
- ezyang/htmlpurifier: ^4.5
- huang-yi/swoole-watcher: ~0.0
- koala-framework/file-watcher: ~1.0
- lcobucci/jwt: ~3.2
- luoxiaojun1992/laravel-elasticsearch: ~1.0
- openzipkin/zipkin: 1.3.2
- overtrue/flysystem-qiniu: ~1
- php-amqplib/php-amqplib: 2.8.1
- robgridley/flysystem-smb: ~1.0.3
- symfony/translation: ~4.0.0|~5.3.0
- symfony/var-dumper: ~3.0|~5.3.0
- xxtime/flysystem-aliyun-oss: 1.2.0
- zendframework/zend-diactoros: ~2.1
This package is auto-updated.
Last update: 2024-10-24 12:29:24 UTC
README
Description
Swoole http server without framework
Features
- Faster Router
- Router & Global Middleware
- Model(MySQL & Eleasticsearch、Json Serializable、Array Accessable)
- Query Builder(MySQL & Elasticsearch)
- Connection Pool(MySQL、Redis、Experimental AMQP-0-9-1、Experimental HBase)
- Storage(File、Qiniu、Alioss)
- Full Coroutine
- Log(Based on Monolog)
- Distributed Lock(Based on Redis)
- Parameter Validator
- Monitor
- AMQP-0-9-1
- Zipkin Trace
- Dynamic Fault Injection
- Hot Reload(including biz code、config、router, recommended for dev only)
- Experimental Grpc(must open http2)
- Apollo Config Center
Notice
- Don't include io operation in controller or middleware constructor
- Don't open preemptive scheduler
Composer Package Review Suggestion
- Namespace conflicts
- Duplication of functions without namespace
Requirements
- Composer 1.x
- PHP 7.1+
- Swoole 4.2.10+
Installation
composer create-project luoxiaojun/sw-fw-less-app=dev-master sw-fw-less --prefer-dist -vvv
Deployment
Nginx
Nginx Config Demo(Modify according to your requirements)
server { listen 80; ## Modify according to your requirements server_name www.sw-fw-less.dev; location / { ## Modify according to your requirements proxy_pass http://127.0.0.1:9501; } }
Docker
docker run -d -P luoxiaojun1992/sw-fw-less:latest
Usage
Start Server
php start.php
Demo Api
curl -i 'http://127.0.0.1:9501/ping'
Grpc Generator
cd tools && ./generate_grpc.sh path/to/grpc/bins/opt/grpc_php_plugin
Performance
Environment:
- OS: MacOS 10.14.1
- CPU: 2.3 GHz Intel Core i5 4 Cores
- Memory: 16 GB 2133 MHz LPDDR3
- Swoole: 4.2.9
- PHP: 7.2.8
- Redis: 4.0.11
- API: http://127.0.0.1:9501/redis?key=key
- Concurrent: 300
- Tool: JMeter 4.0 r1823414
Document
Please see document.
Roadmap
- Add helper functions namespace