Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ make && sudo make install

## 💎 框架 & 组件

- [**Hyperf**](https://github.com/hyperf-cloud/hyperf) 是一个高性能、高灵活性的协程框架,存在丰富的可能性,如实现分布式中间件,微服务架构等
- [**Hyperf**](https://github.com/hyperf/hyperf) 是一个高性能、高灵活性的协程框架,存在丰富的可能性,如实现分布式中间件,微服务架构等
- [**Swoft**](https://github.com/swoft-cloud) 是一个现代化的面向切面的高性能协程全栈组件化框架
- [**Easyswoole**](https://www.easyswoole.com) 是一个极简的高性能的框架,让代码开发就好像写`echo "hello world"`一样简单
- [**Saber**](https://github.com/swlib/saber) 是一个人性化的高性能HTTP客户端组件,几乎拥有一切你可以想象的强大功能
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,10 @@ sudo make install
Enable it by adding a new line `extension=swoole_async.so` to `php.ini`.

## 💎 Frameworks & Components
- [**Hyperf**](https://github.com/hyperf-cloud/hyperf) is a coroutine framework that focuses on hyperspeed and flexibility, specifically used for build microservices or middlewares.
- [**Hyperf**](https://github.com/hyperf/hyperf) is a coroutine framework that focuses on hyperspeed and flexibility, specifically used for build microservices or middlewares.
- [**Swoft**](https://github.com/swoft-cloud/swoft) is a modern, high-performance AOP and coroutine PHP framework.
- [**Easyswoole**](https://www.easyswoole.com) is a simple, high-performance PHP framework, based on Swoole, which makes using Swoole as easy as `echo "hello world"`.
- [**Saber**](https://github.com/swlib/saber) Is a human-friendly, high-performance HTTP client component that has almost everything you can imagine.
- [**Saber**](https://github.com/swlib/saber) is a human-friendly, high-performance HTTP client component that has almost everything you can imagine.

## 🛠 Develop & Discussion

Expand Down
2 changes: 1 addition & 1 deletion library/alias.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
if (ini_get('swoole.use_shortname') === 'On') {
if (SWOOLE_USE_SHORTNAME) {
class_alias(Swoole\Coroutine\WaitGroup::class, Co\WaitGroup::class, false);
class_alias(Swoole\Coroutine\Server::class, Co\Server::class, false);
}
2 changes: 1 addition & 1 deletion library/alias_ns.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function run(callable $fn, ...$args)

namespace Co {

if (ini_get('swoole.use_shortname') === 'On') {
if (SWOOLE_USE_SHORTNAME) {
function run(callable $fn, ...$args)
{
return \Swoole\Coroutine\Run($fn, ...$args);
Expand Down
4 changes: 4 additions & 0 deletions library/constants.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
<?php
define('SWOOLE_LIBRARY', true);

$useShortname = ini_get_all('swoole')['swoole.use_shortname']['local_value'];
$useShortname = strtolower(trim(str_replace('0', '', $useShortname)));
define('SWOOLE_USE_SHORTNAME', !in_array($useShortname, ['', 'off', 'false'], true));
2 changes: 1 addition & 1 deletion library/functions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
if (ini_get('swoole.use_shortname') === 'On') {
if (SWOOLE_USE_SHORTNAME) {
/**
* @param string $string
* @return Swoole\StringObject
Expand Down
16 changes: 12 additions & 4 deletions php_swoole_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@

static const char* swoole_library_source_constants =
"\n"
"define('SWOOLE_LIBRARY', true);\n";
"define('SWOOLE_LIBRARY', true);\n"
"\n"
"$useShortname = ini_get_all('swoole')['swoole.use_shortname']['local_value'];\n"
"$useShortname = strtolower(trim(str_replace('0', '', $useShortname)));\n"
"if (! in_array($useShortname, ['', 'off', 'false'], true)) {\n"
" define('SWOOLE_USE_SHORTNAME', true);\n"
"} else {\n"
" define('SWOOLE_USE_SHORTNAME', false);\n"
"}\n";

static const char* swoole_library_source_std_exec =
"\n"
Expand Down Expand Up @@ -2240,7 +2248,7 @@ static const char* swoole_library_source_core_coroutine_server_connection =

static const char* swoole_library_source_functions =
"\n"
"if (ini_get('swoole.use_shortname') === 'On') {\n"
"if (SWOOLE_USE_SHORTNAME) {\n"
" /**\n"
" * @param string $string\n"
" * @return Swoole\\StringObject\n"
Expand Down Expand Up @@ -2291,7 +2299,7 @@ static const char* swoole_library_source_functions =

static const char* swoole_library_source_alias =
"\n"
"if (ini_get('swoole.use_shortname') === 'On') {\n"
"if (SWOOLE_USE_SHORTNAME) {\n"
" class_alias(Swoole\\Coroutine\\WaitGroup::class, Co\\WaitGroup::class, false);\n"
" class_alias(Swoole\\Coroutine\\Server::class, Co\\Server::class, false);\n"
"}\n";
Expand All @@ -2312,7 +2320,7 @@ static const char* swoole_library_source_alias_ns =
"\n"
"namespace Co {\n"
"\n"
" if (ini_get('swoole.use_shortname') === 'On') {\n"
" if (SWOOLE_USE_SHORTNAME) {\n"
" function run(callable $fn, ...$args)\n"
" {\n"
" return \\Swoole\\Coroutine\\Run($fn, ...$args);\n"
Expand Down