Commit 0a346240 authored by 冯超鹏's avatar 冯超鹏

‘sms’

parents
Pipeline #167 failed with stages

Too many changes to show.

To preserve performance only 1000 of ${real_size} files are displayed.

APP_NAME=skeleton
APP_ENV=dev
DB_DRIVER=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=zehongcloud
DB_USERNAME=root
DB_PASSWORD=root
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci
DB_PREFIX=
REDIS_HOST=localhost
REDIS_AUTH=root
REDIS_PORT=6379
REDIS_DB=0
\ No newline at end of file
APP_NAME=skeleton
APP_ENV=dev
DB_DRIVER=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=hyperf
DB_USERNAME=root
DB_PASSWORD=
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci
DB_PREFIX=
REDIS_HOST=localhost
REDIS_AUTH=(null)
REDIS_PORT=6379
REDIS_DB=0
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/hyperf.iml" filepath="$PROJECT_DIR$/.idea/hyperf.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PhpIncludePathManager">
<include_path>
<path value="$PROJECT_DIR$/vendor/nikic/fast-route" />
<path value="$PROJECT_DIR$/vendor/phpspec/prophecy" />
<path value="$PROJECT_DIR$/vendor/symfony/console" />
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/process" />
<path value="$PROJECT_DIR$/vendor/symfony/string" />
<path value="$PROJECT_DIR$/vendor/symfony/service-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/options-resolver" />
<path value="$PROJECT_DIR$/vendor/mockery/mockery" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php72" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-idn" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-normalizer" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php73" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php80" />
<path value="$PROJECT_DIR$/vendor/symfony/filesystem" />
<path value="$PROJECT_DIR$/vendor/symfony/finder" />
<path value="$PROJECT_DIR$/vendor/vlucas/phpdotenv" />
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/symfony/translation" />
<path value="$PROJECT_DIR$/vendor/hyperf/async-queue" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
<path value="$PROJECT_DIR$/vendor/hyperf/server" />
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher-contracts" />
<path value="$PROJECT_DIR$/vendor/hyperf/http-message" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-grapheme" />
<path value="$PROJECT_DIR$/vendor/hyperf/memory" />
<path value="$PROJECT_DIR$/vendor/symfony/translation-contracts" />
<path value="$PROJECT_DIR$/vendor/hyperf/di" />
<path value="$PROJECT_DIR$/vendor/symfony/stopwatch" />
<path value="$PROJECT_DIR$/vendor/hyperf/model-listener" />
<path value="$PROJECT_DIR$/vendor/theseer/tokenizer" />
<path value="$PROJECT_DIR$/vendor/hyperf/logger" />
<path value="$PROJECT_DIR$/vendor/hyperf/guzzle" />
<path value="$PROJECT_DIR$/vendor/hyperf/model-cache" />
<path value="$PROJECT_DIR$/vendor/hyperf/redis" />
<path value="$PROJECT_DIR$/vendor/hyperf/devtool" />
<path value="$PROJECT_DIR$/vendor/hyperf/database" />
<path value="$PROJECT_DIR$/vendor/hyperf/elasticsearch" />
<path value="$PROJECT_DIR$/vendor/hyperf/utils" />
<path value="$PROJECT_DIR$/vendor/hyperf/rpc-server" />
<path value="$PROJECT_DIR$/vendor/hyperf/http-server" />
<path value="$PROJECT_DIR$/vendor/hyperf/constants" />
<path value="$PROJECT_DIR$/vendor/react/promise" />
<path value="$PROJECT_DIR$/vendor/hyperf/paginator" />
<path value="$PROJECT_DIR$/vendor/hyperf/event" />
<path value="$PROJECT_DIR$/vendor/hyperf/dispatcher" />
<path value="$PROJECT_DIR$/vendor/myclabs/deep-copy" />
<path value="$PROJECT_DIR$/vendor/hyperf/cache" />
<path value="$PROJECT_DIR$/vendor/doctrine/instantiator" />
<path value="$PROJECT_DIR$/vendor/hyperf/process" />
<path value="$PROJECT_DIR$/vendor/doctrine/inflector" />
<path value="$PROJECT_DIR$/vendor/hyperf/rpc" />
<path value="$PROJECT_DIR$/vendor/doctrine/annotations" />
<path value="$PROJECT_DIR$/vendor/hyperf/amqp" />
<path value="$PROJECT_DIR$/vendor/doctrine/lexer" />
<path value="$PROJECT_DIR$/vendor/hyperf/contract" />
<path value="$PROJECT_DIR$/vendor/hyperf/pool" />
<path value="$PROJECT_DIR$/vendor/hyperf/db-connection" />
<path value="$PROJECT_DIR$/vendor/hyperf/tracer" />
<path value="$PROJECT_DIR$/vendor/hyperf/command" />
<path value="$PROJECT_DIR$/vendor/hyperf/load-balancer" />
<path value="$PROJECT_DIR$/vendor/hyperf/exception-handler" />
<path value="$PROJECT_DIR$/vendor/hyperf/framework" />
<path value="$PROJECT_DIR$/vendor/hamcrest/hamcrest-php" />
<path value="$PROJECT_DIR$/vendor/hyperf/config-aliyun-acm" />
<path value="$PROJECT_DIR$/vendor/jcchavezs/zipkin-opentracing" />
<path value="$PROJECT_DIR$/vendor/hyperf/json-rpc" />
<path value="$PROJECT_DIR$/vendor/jetbrains/phpstorm-stubs" />
<path value="$PROJECT_DIR$/vendor/hyperf/rpc-client" />
<path value="$PROJECT_DIR$/vendor/phpoption/phpoption" />
<path value="$PROJECT_DIR$/vendor/hyperf/config" />
<path value="$PROJECT_DIR$/vendor/phpseclib/phpseclib" />
<path value="$PROJECT_DIR$/vendor/roave/signature" />
<path value="$PROJECT_DIR$/vendor/roave/better-reflection" />
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
<path value="$PROJECT_DIR$/vendor/ezimuel/guzzlestreams" />
<path value="$PROJECT_DIR$/vendor/ezimuel/ringphp" />
<path value="$PROJECT_DIR$/vendor/phar-io/manifest" />
<path value="$PROJECT_DIR$/vendor/phar-io/version" />
<path value="$PROJECT_DIR$/vendor/sebastian/global-state" />
<path value="$PROJECT_DIR$/vendor/sebastian/comparator" />
<path value="$PROJECT_DIR$/vendor/sebastian/environment" />
<path value="$PROJECT_DIR$/vendor/sebastian/exporter" />
<path value="$PROJECT_DIR$/vendor/sebastian/recursion-context" />
<path value="$PROJECT_DIR$/vendor/sebastian/object-enumerator" />
<path value="$PROJECT_DIR$/vendor/sebastian/object-reflector" />
<path value="$PROJECT_DIR$/vendor/sebastian/resource-operations" />
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
<path value="$PROJECT_DIR$/vendor/sebastian/diff" />
<path value="$PROJECT_DIR$/vendor/swoole/ide-helper" />
<path value="$PROJECT_DIR$/vendor/sebastian/version" />
<path value="$PROJECT_DIR$/vendor/composer" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-timer" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-file-iterator" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-text-template" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-token-stream" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-code-coverage" />
<path value="$PROJECT_DIR$/vendor/webmozart/assert" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/guzzle" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/psr7" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/promises" />
<path value="$PROJECT_DIR$/vendor/nesbot/carbon" />
<path value="$PROJECT_DIR$/vendor/phpstan/phpstan" />
<path value="$PROJECT_DIR$/vendor/phpunit/phpunit" />
<path value="$PROJECT_DIR$/vendor/nikic/php-parser" />
<path value="$PROJECT_DIR$/vendor/hyperf/testing" />
<path value="$PROJECT_DIR$/vendor/friendsofphp/php-cs-fixer" />
<path value="$PROJECT_DIR$/vendor/fig/http-message-util" />
<path value="$PROJECT_DIR$/vendor/openzipkin/zipkin" />
<path value="$PROJECT_DIR$/vendor/psr/container" />
<path value="$PROJECT_DIR$/vendor/psr/http-message" />
<path value="$PROJECT_DIR$/vendor/psr/event-dispatcher" />
<path value="$PROJECT_DIR$/vendor/psr/log" />
<path value="$PROJECT_DIR$/vendor/opentracing/opentracing" />
<path value="$PROJECT_DIR$/vendor/psr/http-server-middleware" />
<path value="$PROJECT_DIR$/vendor/psr/simple-cache" />
<path value="$PROJECT_DIR$/vendor/psr/http-server-handler" />
<path value="$PROJECT_DIR$/vendor/php-amqplib/php-amqplib" />
<path value="$PROJECT_DIR$/vendor/monolog/monolog" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-stdlib" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-zendframework-bridge" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-mime" />
<path value="$PROJECT_DIR$/vendor/markrogoyski/math-php" />
<path value="$PROJECT_DIR$/vendor/php-cs-fixer/diff" />
<path value="$PROJECT_DIR$/vendor/elasticsearch/elasticsearch" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-docblock" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/type-resolver" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-common" />
<path value="$PROJECT_DIR$/vendor/phper666/hyperf-server-command" />
<path value="$PROJECT_DIR$/vendor/hyperf/crontab" />
<path value="$PROJECT_DIR$/vendor/overtrue/easy-sms" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.2" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
<?php
$header = <<<'EOF'
This file is part of Hyperf.
@link https://www.hyperf.io
@document https://hyperf.wiki
@contact group@hyperf.io
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
EOF;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'header_comment' => [
'commentType' => 'PHPDoc',
'header' => $header,
'separate' => 'none',
'location' => 'after_declare_strict',
],
'array_syntax' => [
'syntax' => 'short'
],
'list_syntax' => [
'syntax' => 'short'
],
'concat_space' => [
'spacing' => 'one'
],
'blank_line_before_statement' => [
'statements' => [
'declare',
],
],
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author'
],
],
'ordered_imports' => [
'imports_order' => [
'class', 'function', 'const',
],
'sort_algorithm' => 'alpha',
],
'single_line_comment_style' => [
'comment_types' => [
],
],
'yoda_style' => [
'always_move_variable' => false,
'equal' => false,
'identical' => false,
],
'phpdoc_align' => [
'align' => 'left',
],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'constant_case' => [
'case' => 'lower',
],
'class_attributes_separation' => true,
'combine_consecutive_unsets' => true,
'declare_strict_types' => true,
'linebreak_after_opening_tag' => true,
'lowercase_static_reference' => true,
'no_useless_else' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'not_operator_with_space' => false,
'ordered_class_elements' => true,
'php_unit_strict' => false,
'phpdoc_separation' => false,
'single_quote' => true,
'standardize_not_equals' => true,
'multiline_comment_opening_closing' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('public')
->exclude('runtime')
->exclude('vendor')
->in(__DIR__)
)
->setUsingCache(false);
<?php
namespace PHPSTORM_META {
// Reflect
override(\Psr\Container\ContainerInterface::get(0), map('@'));
override(\Hyperf\Utils\Context::get(0), map('@'));
override(\make(0), map('@'));
override(\di(0), map('@'));
}
\ No newline at end of file
# Default Dockerfile
#
# @link https://www.hyperf.io
# @document https://hyperf.wiki
# @contact group@hyperf.io
# @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
FROM hyperf/hyperf:7.4-alpine-v3.11-cli
LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
##
# ---------- env settings ----------
##
# --build-arg timezone=Asia/Shanghai
ARG timezone
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
COMPOSER_VERSION=1.10.10 \
APP_ENV=prod \
SCAN_CACHEABLE=(true)
# update
RUN set -ex \
# install composer
&& cd /tmp \
&& wget https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar \
&& chmod u+x composer.phar \
&& mv composer.phar /usr/local/bin/composer \
# show php version and extensions
&& php -v \
&& php -m \
&& php --ri swoole \
# ---------- some config ----------
&& cd /etc/php7 \
# - config PHP
&& { \
echo "upload_max_filesize=128M"; \
echo "post_max_size=128M"; \
echo "memory_limit=1G"; \
echo "date.timezone=${TIMEZONE}"; \
} | tee conf.d/99_overrides.ini \
# - config timezone
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone \
# ---------- clear works ----------
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
WORKDIR /opt/www
# Composer Cache
# COPY ./composer.* /opt/www/
# RUN composer install --no-dev --no-scripts
COPY . /opt/www
RUN composer install --no-dev -o && php bin/hyperf.php
EXPOSE 9501
ENTRYPOINT ["php", "/opt/www/bin/hyperf.php", "start"]
# Introduction
This is a skeleton application using the Hyperf framework. This application is meant to be used as a starting place for those looking to get their feet wet with Hyperf Framework.
# Requirements
Hyperf has some requirements for the system environment, it can only run under Linux and Mac environment, but due to the development of Docker virtualization technology, Docker for Windows can also be used as the running environment under Windows.
The various versions of Dockerfile have been prepared for you in the [hyperf\hyperf-docker](https://github.com/hyperf/hyperf-docker) project, or directly based on the already built [hyperf\hyperf](https://hub.docker.com/r/hyperf/hyperf) Image to run.
When you don't want to use Docker as the basis for your running environment, you need to make sure that your operating environment meets the following requirements:
- PHP >= 7.2
- Swoole PHP extension >= 4.4,and Disabled `Short Name`
- OpenSSL PHP extension
- JSON PHP extension
- PDO PHP extension (If you need to use MySQL Client)
- Redis PHP extension (If you need to use Redis Client)
- Protobuf PHP extension (If you need to use gRPC Server of Client)
# Installation using Composer
The easiest way to create a new Hyperf project is to use Composer. If you don't have it already installed, then please install as per the documentation.
To create your new Hyperf project:
$ composer create-project hyperf/hyperf-skeleton path/to/install
Once installed, you can run the server immediately using the command below.
$ cd path/to/install
$ php bin/hyperf.php start
This will start the cli-server on port `9501`, and bind it to all network interfaces. You can then visit the site at `http://localhost:9501/`
which will bring up Hyperf default home page.
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Constants;
use Hyperf\Constants\AbstractConstants;
use Hyperf\Constants\Annotation\Constants;
/**
* @Constants
*/
class ErrorCode extends AbstractConstants
{
/**
* @Message("Server Error!")
*/
const SERVER_ERROR = 500;
}
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Controller;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Psr\Container\ContainerInterface;
abstract class AbstractController
{
/**
* @Inject
* @var ContainerInterface
*/
protected $container;
/**
* @Inject
* @var RequestInterface
*/
protected $request;
/**
* @Inject
* @var ResponseInterface
*/
protected $response;
}
<?php
declare(strict_types=1);
namespace App\Controller;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\DbConnection\Db;
/**
* @Controller()
*/
class IndexController extends AbstractController
{
/**
* @RequestMapping(path="Power_supply", methods="get")
* 设备供电方式
*/
public function Power_supply(RequestInterface $request){
// $users = Db::table('devices')->get();
return '测试';
}
}
\ No newline at end of file
<?php
declare(strict_types=1);
namespace App\Controller;
use Hyperf\HttpServer\Contract\RequestInterface; // 接收请求
use App\Service\QueueService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
use App\Service\ALiSmsService;
/**
* @Controller()
*/
class UserController
{
/**
* @Inject
* @var QueueService
*/
protected $service;
/**
* @Inject
* @var ALiSmsService
*/
protected $smsphone;
/**
* @RequestMapping(path="Power_supply", methods="get")
* 设备供电方式
*/
public function Power_supply()
{
return "测试git";
// $this->service->push([
// 'group@hyperf.io',
// 'https://doc.hyperf.io',
// 'https://www.hyperf.io',
// ]);
// $template_param = ['cphone'=>'18830115570','position'=>'','alarm'=>'离线'];
// $params = array (
// 'SignName' => '泽宏云',
// 'AccessKeyId' => 'LTAI2xiZNF3iV2aV',
// 'TemplateCode' => 'SMS_169897307',
// 'PhoneNumbers' => '18830115570',
// 'TemplateParam' => json_encode($template_param,JSON_UNESCAPED_UNICODE),
// 'RegionId' => 'cn-beijing',
// );
// $accessKeySecret='bprEWwn1M0xgglRQCQEMYSPiYctDk4';
// return $this->smsphone->sendSms($accessKeySecret,$params);
}
}
\ No newline at end of file
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Exception;
use App\Constants\ErrorCode;
use Hyperf\Server\Exception\ServerException;
use Throwable;
class BusinessException extends ServerException
{
public function __construct(int $code = 0, string $message = null, Throwable $previous = null)
{
if (is_null($message)) {
$message = ErrorCode::getMessage($code);
}
parent::__construct($message, $code, $previous);
}
}
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Exception\Handler;
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\ExceptionHandler\ExceptionHandler;
use Hyperf\HttpMessage\Stream\SwooleStream;
use Psr\Http\Message\ResponseInterface;
use Throwable;
class AppExceptionHandler extends ExceptionHandler
{
/**
* @var StdoutLoggerInterface
*/
protected $logger;
public function __construct(StdoutLoggerInterface $logger)
{
$this->logger = $logger;
}
public function handle(Throwable $throwable, ResponseInterface $response)
{
$this->logger->error(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile()));
$this->logger->error($throwable->getTraceAsString());
return $response->withHeader('Server', 'Hyperf')->withStatus(500)->withBody(new SwooleStream('Internal Server Error.'));
}
public function isValid(Throwable $throwable): bool
{
return true;
}
}
<?php
declare(strict_types=1);
namespace App\Job;
use Hyperf\AsyncQueue\Job;
use App\Service\ALiSmsService;
use Hyperf\Utils\ApplicationContext;
class ExampleJob extends Job
{
/**
* 任务执行失败后的重试次数,即最大执行次数为 $maxAttempts+1 次
*
* @var int
*/
protected $maxAttempts = 2;
public $params;
private $redisClient;
public function __construct($params)
{
// 这里最好是普通数据,不要使用携带 IO 的对象,比如 PDO 对象
$this->params = $params;
}
public function handle()
{
/*
* @$data 队列消费数据
* @$sms 实例化发短信类
* @$template_param 配置参数
// * @$caturt @$container 实例化redis
* */
$data = $this->params;
$sms = new ALiSmsService();
$caturt = new ApplicationContext();
$container = $caturt->getContainer();
$this->redisClient = $container->get(\Redis::class);
// 判断redis是否有当前已发送信息
// if (!$this->redisClient->get($data['typedevicenum'])) {
// $template_param = ['cphone' => $data['phone'], 'position' => '您的设备尾号为' . $data['devicenum'], 'alarm' => '离线'];
// $params = array(
// 'SignName' => '泽宏云',
// 'AccessKeyId' => 'LTAI2xiZNF3iV2aV',
// 'TemplateCode' => 'SMS_169897307',
// 'PhoneNumbers' => $data['phone'],
// 'TemplateParam' => json_encode($template_param, JSON_UNESCAPED_UNICODE),
// 'RegionId' => 'cn-beijing',
// );
// $accessKeySecret = 'bprEWwn1M0xgglRQCQEMYSPiYctDk4';
// $response = $sms->sendSms($accessKeySecret, $params);
// if ($response['Message'] == 'OK' && $response['Code'] == 'OK') {
// $redisdata = ['data'=>$data,'sendSms'=>$response,'time'=>time()];
// $this->redisClient->set($data['typedevicenum'], json_encode($redisdata));
// }
// }
}
}
\ No newline at end of file
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Listener;
use Hyperf\Database\Events\QueryExecuted;
use Hyperf\Event\Annotation\Listener;
use Hyperf\Event\Contract\ListenerInterface;
use Hyperf\Logger\LoggerFactory;
use Hyperf\Utils\Arr;
use Hyperf\Utils\Str;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
/**
* @Listener
*/
class DbQueryExecutedListener implements ListenerInterface
{
/**
* @var LoggerInterface
*/
private $logger;
public function __construct(ContainerInterface $container)
{
$this->logger = $container->get(LoggerFactory::class)->get('sql');
}
public function listen(): array
{
return [
QueryExecuted::class,
];
}
/**
* @param QueryExecuted $event
*/
public function process(object $event)
{
if ($event instanceof QueryExecuted) {
$sql = $event->sql;
if (! Arr::isAssoc($event->bindings)) {
foreach ($event->bindings as $key => $value) {
$sql = Str::replaceFirst('?', "'{$value}'", $sql);
}
}
$this->logger->info(sprintf('[%s] %s', $event->time, $sql));
}
}
}
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Listener;
use Hyperf\AsyncQueue\Event\AfterHandle;
use Hyperf\AsyncQueue\Event\BeforeHandle;
use Hyperf\AsyncQueue\Event\Event;
use Hyperf\AsyncQueue\Event\FailedHandle;
use Hyperf\AsyncQueue\Event\RetryHandle;
use Hyperf\Event\Annotation\Listener;
use Hyperf\Event\Contract\ListenerInterface;
use Hyperf\ExceptionHandler\Formatter\FormatterInterface;
use Hyperf\Logger\LoggerFactory;
/**
* @Listener
*/
class QueueHandleListener implements ListenerInterface
{
/**
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
/**
* @var FormatterInterface
*/
protected $formatter;
public function __construct(LoggerFactory $loggerFactory, FormatterInterface $formatter)
{
$this->logger = $loggerFactory->get('queue');
$this->formatter = $formatter;
}
public function listen(): array
{
return [
AfterHandle::class,
BeforeHandle::class,
FailedHandle::class,
RetryHandle::class,
];
}
public function process(object $event)
{
if ($event instanceof Event && $event->message->job()) {
$job = $event->message->job();
$jobClass = get_class($job);
$date = date('Y-m-d H:i:s');
switch (true) {
case $event instanceof BeforeHandle:
$this->logger->info(sprintf('[%s] Processing %s.', $date, $jobClass));
break;
case $event instanceof AfterHandle:
$this->logger->info(sprintf('[%s] Processed %s.', $date, $jobClass));
break;
case $event instanceof FailedHandle:
$this->logger->error(sprintf('[%s] Failed %s.', $date, $jobClass));
$this->logger->error($this->formatter->format($event->getThrowable()));
break;
case $event instanceof RetryHandle:
$this->logger->warning(sprintf('[%s] Retried %s.', $date, $jobClass));
break;
}
}
}
}
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\DbConnection\Model\Model;
class DevicesModel extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'devices';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [];
public function devicephone()
{
$data = self::where(['dtype' => 13, 'power_supply' => 2, 'status' => 9])
->join('users', 'devices.username', '=', 'users.username')
->select('users.phone', 'devices.devicenum')
->get();
if ($data) {
return $data;
} else {
return '';
}
}
}
\ No newline at end of file
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\DbConnection\Model\Model as BaseModel;
use Hyperf\ModelCache\Cacheable;
use Hyperf\ModelCache\CacheableInterface;
abstract class Model extends BaseModel implements CacheableInterface
{
use Cacheable;
}
<?php
declare(strict_types=1);
namespace App\Process;
use Hyperf\AsyncQueue\Process\ConsumerProcess;
use Hyperf\Process\Annotation\Process;
/**
* @Process
*/
class AsyncQueueConsumer extends ConsumerProcess
{
}
<?php
declare(strict_types=1);
namespace App\Service;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Guzzle\ClientFactory;
class ALiSmsService
{
/**
* @Inject
* @var \Hyperf\Guzzle\ClientFactory
*/
private $clientFactory;
private $url = 'https://dysmsapi.aliyuncs.com?';
// public function __construct(ClientFactory $clientFactory)
// {
// $this->clientFactory = $clientFactory;
// }
private function percentEncode($string) {
$string = urlencode ( $string );
$string = preg_replace ( '/\+/', '%20', $string );
$string = preg_replace ( '/\*/', '%2A', $string );
$string = preg_replace ( '/%7E/', '~', $string );
return $string;
}
protected function getPublicParam()
{
return $params = array (
'Version' => '2017-05-25',
'Timestamp' => gmdate ( 'Y-m-d\TH:i:s\Z' ),
'SignatureVersion' => '1.0',
'SignatureNonce' => uniqid (),
'SignatureMethod' => 'HMAC-SHA1',
'Format' => 'JSON'
);
}
protected function getSign(string $accessKeySecret,$array=array())
{
$params = $this->getPublicParam();
$newArray = array_merge($params,$array);
unset($newArray['Signature']);
ksort ( $newArray );
$canonicalizedQueryString = '';
foreach ( $newArray as $key => $value ) {
$canonicalizedQueryString .= '&' . $this->percentEncode ( $key ) . '=' . $this->percentEncode ( $value );
}
$stringToSign = 'GET&%2F&' . $this->percentencode ( substr ( $canonicalizedQueryString, 1 ) );
$signature = base64_encode ( hash_hmac ( 'sha1', $stringToSign, $accessKeySecret . '&', true ) );
$newArray ['Signature'] = $signature;
$client = $this->clientFactory->create($options=[]);
$url = $this->url . http_build_query ( $newArray );
$result = $client->request('get',$url);
return json_decode($result->getBody()->getContents(),true);
}
public function sendSms(string $accessKeySecret,$array=array())
{
$array['Action']='SendSms';
return $this->getSign($accessKeySecret,$array);
}
public function phoneNumberJson(string $accessKeySecret,$array=array())
{
$array['Action']='SendBatchSms';
return $this->getSign($accessKeySecret,$array);
}
public function getSendDetails(string $accessKeySecret,$array=array())
{
$array['Action']='QuerySendDetails';
return $this->getSign($accessKeySecret,$array);
}
}
\ No newline at end of file
<?php
declare(strict_types=1);
namespace App\Service;
use App\Job\ExampleJob;
use Hyperf\AsyncQueue\Driver\DriverFactory;
use Hyperf\AsyncQueue\Driver\DriverInterface;
class QueueService
{
/**
* @var DriverInterface
*/
protected $driver;
public function __construct(DriverFactory $driverFactory)
{
$this->driver = $driverFactory->get('default');
}
/**
* 生产消息.
* @param $params 数据
* @param int $delay 延时时间 单位秒
*/
public function push($params, int $delay = 0): bool
{
return $this->driver->push(new ExampleJob($params), $delay);
}
/**
* 队列详情信息.
* @param int $delay 延时时间 单位秒
*/
public function info(): array
{
return $this->driver->info();
}
public function pop(): array
{
return $this->driver->pop();
}
}
\ No newline at end of file
<?php
namespace App\Task;
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Logger\LoggerFactory;
use App\Model\DevicesModel;
use App\Service\QueueService;
use App\Service\ALiSmsService;
use Hyperf\Utils\ApplicationContext;
class FooTask
{
/**
* @Inject
* @var QueueService
*/
protected $service;
private $logger;
private $DevicesModel;
private $redisClient;
/**
* @Inject
* @var ALiSmsService
*/
protected $smsphone;
public function __construct(LoggerFactory $loggerFactory, DevicesModel $devicesModel)
{
$this->logger = $loggerFactory->get('log', 'default');
$container = ApplicationContext::getContainer();
$this->redisClient = $container->get(\Redis::class);
$this->DevicesModel = $devicesModel;
}
public function execute()
{
$data = $this->DevicesModel->devicephone();
if ($data != '') {
$this->jsondata($data);
}
}
//解出 json 字符串
public function jsondata($info)
{
$data = [];
$infos = json_decode($info, true);
foreach ($infos as $key => $value) {
if (substr($value['phone'], 0, 1) == '[') {
$newphone = json_decode($value['phone'], true);
foreach ($newphone as $k => $v) {
$infodata = ['phone' => $v['cphone'], 'devicenum' => substr($value['devicenum'], -3), 'typedevicenum' => $value['devicenum']];
array_push($data, $infodata);
}
} else {
$infodatas = ['phone' => $value['phone'], 'devicenum' => substr($value['devicenum'], -3), 'typedevicenum' => $value['devicenum']];
array_push($data, $infodatas);
}
}
return $this->toarray($data);
}
//
/*二维数组去重*/
public function toarray($data)
{
$public_info = [];
for ($i = 0; $i < count($data); $i++) {
$a = $data[$i];
unset($data[$i]);
if (!in_array($a, $data)) {
$public_info[] = $a;
}
}
return $this->example($public_info);
}
//
/*数组总量进行判断*/
public function example($data)
{
if (count($data) > 1) {
foreach ($data as $key => $value) {
$newdata = ['phone' => $value['phone'], 'devicenum' => $value['devicenum'], 'typedevicenum' => $value['typedevicenum']];
$this->service->push($newdata);
}
} else {
if(!$this->redisClient->get($data['typedevicenum'])){
$smsdata = $data[0]['phone'];
$template_param = ['cphone' => $data[0]['phone'], 'position' => '您的设备尾号为' . $data[0]['devicenum'], 'alarm' => '离线'];
$typeinfo = $this->smsphone($template_param, $smsdata);
if ($typeinfo['Message'] == 'OK' ||$typeinfo['Code'] == 'OK') {
$redisdata = ['data'=>$data,'sendSms'=>json_decode($typeinfo, true),'time'=>time()];
$this->redisClient->set($data[0]['typedevicenum'], json_encode($redisdata));
}
}
}
}
public function smsphone($template_param, $phone)
{
$params = array(
'SignName' => '泽宏云',
'AccessKeyId' => 'LTAI2xiZNF3iV2aV',
'TemplateCode' => 'SMS_169897307',
'PhoneNumbers' => $phone,
'TemplateParam' => json_encode($template_param, JSON_UNESCAPED_UNICODE),
'RegionId' => 'cn-beijing',
);
return $this->smsphone->sendSms('bprEWwn1M0xgglRQCQEMYSPiYctDk4', $params);
}
}
\ No newline at end of file
#!/usr/bin/env php
<?php
ini_set('display_errors', 'on');
ini_set('display_startup_errors', 'on');
error_reporting(E_ALL);
date_default_timezone_set('PRC');
! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
! defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', SWOOLE_HOOK_ALL);
require BASE_PATH . '/vendor/autoload.php';
// Self-called anonymous function that creates its own scope and keep the global namespace clean.
(function () {
Hyperf\Di\ClassLoader::init();
/** @var \Psr\Container\ContainerInterface $container */
$container = require BASE_PATH . '/config/container.php';
$application = $container->get(\Hyperf\Contract\ApplicationInterface::class);
$application->run();
})();
{
"name": "hyperf/hyperf-skeleton",
"type": "project",
"keywords": [
"php",
"swoole",
"framework",
"hyperf",
"microservice",
"middleware"
],
"description": "A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.",
"license": "Apache-2.0",
"require": {
"php": ">=7.2",
"ext-swoole": ">=4.5",
"hyperf/cache": "~2.0.0",
"hyperf/command": "~2.0.0",
"hyperf/config": "~2.0.0",
"hyperf/db-connection": "~2.0.0",
"hyperf/framework": "~2.0.0",
"hyperf/guzzle": "^2.0",
"hyperf/http-server": "~2.0.0",
"hyperf/logger": "~2.0.0",
"hyperf/memory": "~2.0.0",
"hyperf/process": "~2.0.0",
"hyperf/redis": "~2.0.0",
"hyperf/database": "~2.0.0",
"hyperf/json-rpc": "~2.0.0",
"hyperf/rpc": "~2.0.0",
"hyperf/rpc-client": "~2.0.0",
"hyperf/rpc-server": "~2.0.0",
"hyperf/config-aliyun-acm": "~2.0.0",
"hyperf/constants": "~2.0.0",
"hyperf/async-queue": "^2.0",
"hyperf/amqp": "~2.0.0",
"hyperf/model-cache": "~2.0.0",
"hyperf/elasticsearch": "~2.0.0",
"hyperf/tracer": "~2.0.0",
"phper666/hyperf-server-command": "~1.0.0",
"hyperf/crontab": "^2.0",
"overtrue/easy-sms": "^1.1"
},
"require-dev": {
"swoole/ide-helper": "^4.5",
"friendsofphp/php-cs-fixer": "^2.14",
"mockery/mockery": "^1.0",
"phpstan/phpstan": "^0.12",
"hyperf/devtool": "~2.0.0",
"hyperf/testing": "~2.0.0"
},
"suggest": {
"ext-openssl": "Required to use HTTPS.",
"ext-json": "Required to use JSON.",
"ext-pdo": "Required to use MySQL Client.",
"ext-pdo_mysql": "Required to use MySQL Client.",
"ext-redis": "Required to use Redis Client."
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"files": []
},
"autoload-dev": {
"psr-4": {
"HyperfTest\\": "./test/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": [],
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-autoload-dump": [
"rm -rf runtime/container"
],
"test": "co-phpunit -c phpunit.xml --colors=always",
"cs-fix": "php-cs-fixer fix $1",
"analyse": "phpstan analyse --memory-limit 300M -l 0 -c phpstan.neon ./app ./config",
"start": "php ./bin/hyperf.php start"
}
}
This diff is collapsed.
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'enable' => false,
'interval' => 5,
'endpoint' => env('ALIYUN_ACM_ENDPOINT', 'acm.aliyun.com'),
'namespace' => env('ALIYUN_ACM_NAMESPACE', ''),
'data_id' => env('ALIYUN_ACM_DATA_ID', ''),
'group' => env('ALIYUN_ACM_GROUP', 'DEFAULT_GROUP'),
'access_key' => env('ALIYUN_ACM_AK', ''),
'secret_key' => env('ALIYUN_ACM_SK', ''),
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'host' => 'localhost',
'port' => 5672,
'user' => 'guest',
'password' => 'guest',
'vhost' => '/',
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
],
'params' => [
'insist' => false,
'login_method' => 'AMQPLAIN',
'login_response' => null,
'locale' => 'en_US',
'connection_timeout' => 3.0,
'read_write_timeout' => 6.0,
'context' => null,
'keepalive' => false,
'heartbeat' => 3,
],
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'scan' => [
'paths' => [
BASE_PATH . '/app',
],
'ignore_annotations' => [
'mixin',
],
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
];
<?php
declare(strict_types=1);
return [
'default' => [
'driver' => Hyperf\AsyncQueue\Driver\RedisDriver::class,
'redis' => [
'pool' => 'default'
],
'channel' => 'data',
'timeout' => 2,
'retry_seconds' => 5,
'handle_timeout' => 10,
'processes' => 1,
'concurrent' => [
'limit' => 5,
],
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'driver' => Hyperf\Cache\Driver\RedisDriver::class,
'packer' => Hyperf\Utils\Packer\PhpSerializerPacker::class,
'prefix' => 'c:',
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
];
<?php
use Hyperf\Crontab\Crontab;
return [
'enable' => true,
'crontab' => [
(new Crontab())->setName('Foo')->setRule('*/3 * * * * *')->setCallback([App\Task\FooTask::class, 'execute'])->setMemo('负责进行查询所要的数据'),
],
];
\ No newline at end of file
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'driver' => env('DB_DRIVER', 'mysql'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 3306),
'database' => env('DB_DATABASE', 'hyperf'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => env('DB_PREFIX', ''),
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'max_idle_time' => (float) env('DB_MAX_IDLE_TIME', 60),
],
'cache' => [
'handler' => Hyperf\ModelCache\Handler\RedisHandler::class,
'cache_key' => '{mc:%s:m:%s}:%s:%s',
'prefix' => 'default',
'ttl' => 3600 * 24,
'empty_model_ttl' => 600,
'load_script' => true,
],
'commands' => [
'gen:model' => [
'path' => 'app/Model',
'force_casts' => true,
'inheritance' => 'Model',
'uses' => '',
'table_mapping' => [],
],
],
],
];
<?php
declare(strict_types=1);
return [
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'generator' => [
'amqp' => [
'consumer' => [
'namespace' => 'App\\Amqp\\Consumer',
],
'producer' => [
'namespace' => 'App\\Amqp\\Producer',
],
],
'aspect' => [
'namespace' => 'App\\Aspect',
],
'command' => [
'namespace' => 'App\\Command',
],
'controller' => [
'namespace' => 'App\\Controller',
],
'job' => [
'namespace' => 'App\\Job',
],
'listener' => [
'namespace' => 'App\\Listener',
],
'middleware' => [
'namespace' => 'App\\Middleware',
],
'Process' => [
'namespace' => 'App\\Processes',
],
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'handler' => [
'http' => [
Hyperf\HttpServer\Exception\Handler\HttpExceptionHandler::class,
App\Exception\Handler\AppExceptionHandler::class,
],
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
Hyperf\AsyncQueue\Listener\ReloadChannelListener::class,
Hyperf\AsyncQueue\Listener\QueueLengthListener::class
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'handler' => [
'class' => Monolog\Handler\StreamHandler::class,
'constructor' => [
'stream' => BASE_PATH . '/runtime/logs/hyperf.log',
'level' => Monolog\Logger::DEBUG,
],
],
'formatter' => [
'class' => Monolog\Formatter\LineFormatter::class,
'constructor' => [
'format' => null,
'dateFormat' => 'Y-m-d H:i:s',
'allowInlineLineBreaks' => true,
],
],
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'http' => [
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Zipkin\Samplers\BinarySampler;
return [
'default' => env('TRACER_DRIVER', 'zipkin'),
'enable' => [
'guzzle' => env('TRACER_ENABLE_GUZZLE', false),
'redis' => env('TRACER_ENABLE_REDIS', false),
'db' => env('TRACER_ENABLE_DB', false),
'method' => env('TRACER_ENABLE_METHOD', false),
],
'tracer' => [
'zipkin' => [
'driver' => \Hyperf\Tracer\Adapter\ZipkinTracerFactory::class,
'app' => [
'name' => env('APP_NAME', 'skeleton'),
// Hyperf will detect the system info automatically as the value if ipv4, ipv6, port is null
'ipv4' => '127.0.0.1',
'ipv6' => null,
'port' => 9501,
],
'options' => [
'endpoint_url' => env('ZIPKIN_ENDPOINT_URL', 'http://localhost:9411/api/v2/spans'),
'timeout' => env('ZIPKIN_TIMEOUT', 1),
],
'sampler' => BinarySampler::createAsAlwaysSample(),
],
'jaeger' => [
'driver' => \Hyperf\Tracer\Adapter\JaegerTracerFactory::class,
'name' => env('APP_NAME', 'skeleton'),
'options' => [
'local_agent' => [
'reporting_host' => env('JAEGER_REPORTING_HOST', 'localhost'),
'reporting_port' => env('JAEGER_REPORTING_PORT', 5775),
],
],
],
],
];
<?php
declare(strict_types=1);
return [
Hyperf\Crontab\Process\CrontabDispatcherProcess::class,
Hyperf\AsyncQueue\Process\ConsumerProcess::class,
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'auth' => env('REDIS_AUTH', null),
'port' => (int) env('REDIS_PORT', 6379),
'db' => (int) env('REDIS_DB', 0),
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60),
],
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Server\Server;
use Hyperf\Server\SwooleEvent;
return [
'mode' => SWOOLE_PROCESS,
'servers' => [
[
'name' => 'http',
'type' => Server::SERVER_HTTP,
'host' => '127.0.0.1',
'port' => 9501,
'sock_type' => SWOOLE_SOCK_TCP,
'callbacks' => [
SwooleEvent::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
],
],
],
'settings' => [
'enable_coroutine' => true,
'worker_num' => swoole_cpu_num(),
'pid_file' => BASE_PATH . '/runtime/hyperf.pid',
'open_tcp_nodelay' => true,
'max_coroutine' => 100000,
'open_http2_protocol' => true,
'max_request' => 100000,
'socket_buffer_size' => 2 * 1024 * 1024,
'buffer_output_size' => 2 * 1024 * 1024,
],
'callbacks' => [
SwooleEvent::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
SwooleEvent::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
SwooleEvent::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'consumers' => [
[
// The service name, this name should as same as with the name of service provider.
'name' => 'YourServiceName',
// The service registry, if `nodes` is missing below, then you should provide this configs.
'registry' => [
'protocol' => 'consul',
'address' => 'Enter the address of service registry',
],
// If `registry` is missing, then you should provide the nodes configs.
'nodes' => [
// Provide the host and port of the service provider.
// ['host' => 'The host of the service provider', 'port' => 9502]
],
],
],
];
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Contract\StdoutLoggerInterface;
use Psr\Log\LogLevel;
return [
'app_name' => env('APP_NAME', 'skeleton'),
'app_env' => env('APP_ENV', 'dev'),
'scan_cacheable' => env('SCAN_CACHEABLE', false),
StdoutLoggerInterface::class => [
'log_level' => [
LogLevel::ALERT,
LogLevel::CRITICAL,
LogLevel::DEBUG,
LogLevel::EMERGENCY,
LogLevel::ERROR,
LogLevel::INFO,
LogLevel::NOTICE,
LogLevel::WARNING,
],
],
];
<?php
/**
* Initialize a dependency injection container that implemented PSR-11 and return the container.
*/
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Di\Container;
use Hyperf\Di\Definition\DefinitionSourceFactory;
use Hyperf\Utils\ApplicationContext;
$container = new Container((new DefinitionSourceFactory(true))());
if (! $container instanceof \Psr\Container\ContainerInterface) {
throw new RuntimeException('The dependency injection container is invalid.');
}
return ApplicationContext::setContainer($container);
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\HttpServer\Router\Router;
Router::addRoute(['GET', 'POST', 'HEAD'], '/', 'App\Controller\IndexController@index');
Router::get('/favicon.ico', function () {
return '';
});
version: '3.7'
services:
hyperf:
image: $REGISTRY_URL/$PROJECT_NAME:test
environment:
- "APP_PROJECT=hyperf"
- "APP_ENV=test"
ports:
- 9501:9501
deploy:
replicas: 1
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
update_config:
parallelism: 2
delay: 5s
order: start-first
networks:
- hyperf_net
configs:
- source: hyperf_v1.0
target: /opt/www/.env
configs:
hyperf_v1.0:
external: true
networks:
hyperf_net:
external: true
File added
# Magic behaviour with __get, __set, __call and __callStatic is not exactly static analyser-friendly :)
# Fortunately, You can ingore it by the following config.
#
# vendor/bin/phpstan analyse app --memory-limit 200M -l 0
#
parameters:
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- '#Static call to instance method Hyperf\\HttpServer\\Router\\Router::[a-zA-Z0-9\\_]+\(\)#'
- '#Static call to instance method Hyperf\\DbConnection\\Db::[a-zA-Z0-9\\_]+\(\)#'
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="./test/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">./test</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
</phpunit>
a:2:{i:0;s:36:"Hyperf\Config\Annotation\ValueAspect";i:1;s:33:"Hyperf\Di\Annotation\InjectAspect";}
\ No newline at end of file
This diff is collapsed.
<?php
declare (strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Controller;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Psr\Container\ContainerInterface;
abstract class AbstractController
{
use \Hyperf\Di\Aop\ProxyTrait;
use \Hyperf\Di\Aop\PropertyHandlerTrait;
function __construct()
{
$this->__handlePropertyHandler(__CLASS__);
}
/**
* @Inject
* @var ContainerInterface
*/
protected $container;
/**
* @Inject
* @var RequestInterface
*/
protected $request;
/**
* @Inject
* @var ResponseInterface
*/
protected $response;
}
\ No newline at end of file
<?php
declare (strict_types=1);
namespace App\Controller;
use Hyperf\HttpServer\Contract\RequestInterface;
// 接收请求
use App\Service\QueueService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
use App\Service\ALiSmsService;
/**
* @Controller()
*/
class UserController
{
use \Hyperf\Di\Aop\ProxyTrait;
use \Hyperf\Di\Aop\PropertyHandlerTrait;
function __construct()
{
$this->__handlePropertyHandler(__CLASS__);
}
/**
* @Inject
* @var QueueService
*/
protected $service;
/**
* @Inject
* @var ALiSmsService
*/
protected $smsphone;
/**
* @RequestMapping(path="Power_supply", methods="get")
* 设备供电方式
*/
public function Power_supply()
{
return "测试git";
// $this->service->push([
// 'group@hyperf.io',
// 'https://doc.hyperf.io',
// 'https://www.hyperf.io',
// ]);
// $template_param = ['cphone'=>'18830115570','position'=>'','alarm'=>'离线'];
// $params = array (
// 'SignName' => '泽宏云',
// 'AccessKeyId' => 'LTAI2xiZNF3iV2aV',
// 'TemplateCode' => 'SMS_169897307',
// 'PhoneNumbers' => '18830115570',
// 'TemplateParam' => json_encode($template_param,JSON_UNESCAPED_UNICODE),
// 'RegionId' => 'cn-beijing',
// );
// $accessKeySecret='bprEWwn1M0xgglRQCQEMYSPiYctDk4';
// return $this->smsphone->sendSms($accessKeySecret,$params);
}
}
\ No newline at end of file
<?php
declare (strict_types=1);
namespace App\Job;
use Hyperf\AsyncQueue\Job;
use App\Service\ALiSmsService;
use Hyperf\Di\Annotation\Inject;
class ExampleJob extends Job
{
use \Hyperf\Di\Aop\ProxyTrait;
use \Hyperf\Di\Aop\PropertyHandlerTrait;
/**
* 任务执行失败后的重试次数,即最大执行次数为 $maxAttempts+1 次
*
* @var int
*/
protected $maxAttempts = 2;
public $params;
/**
* @Inject
* @var ALiSmsService
*/
protected $ALiSmsService;
public function __construct($params)
{
$this->__handlePropertyHandler(__CLASS__);
// 这里最好是普通数据,不要使用携带 IO 的对象,比如 PDO 对象
$this->params = $params;
}
public function handle()
{
$data = $this->params;
$smsSphone = $this->ALiSmsService->newQuery()->sendSms();
var_dump($smsSphone);
}
}
\ No newline at end of file
<?php
declare (strict_types=1);
namespace App\Service;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Guzzle\ClientFactory;
class ALiSmsService
{
use \Hyperf\Di\Aop\ProxyTrait;
use \Hyperf\Di\Aop\PropertyHandlerTrait;
function __construct()
{
$this->__handlePropertyHandler(__CLASS__);
}
/**
* @Inject
* @var \Hyperf\Guzzle\ClientFactory
*/
private $clientFactory;
private $url = 'https://dysmsapi.aliyuncs.com?';
// public function __construct(ClientFactory $clientFactory)
// {
// $this->clientFactory = $clientFactory;
// }
private function percentEncode($string)
{
$string = urlencode($string);
$string = preg_replace('/\\+/', '%20', $string);
$string = preg_replace('/\\*/', '%2A', $string);
$string = preg_replace('/%7E/', '~', $string);
return $string;
}
protected function getPublicParam()
{
return $params = array('Version' => '2017-05-25', 'Timestamp' => gmdate('Y-m-d\\TH:i:s\\Z'), 'SignatureVersion' => '1.0', 'SignatureNonce' => uniqid(), 'SignatureMethod' => 'HMAC-SHA1', 'Format' => 'JSON');
}
protected function getSign(string $accessKeySecret, $array = array())
{
$params = $this->getPublicParam();
$newArray = array_merge($params, $array);
unset($newArray['Signature']);
ksort($newArray);
$canonicalizedQueryString = '';
foreach ($newArray as $key => $value) {
$canonicalizedQueryString .= '&' . $this->percentEncode($key) . '=' . $this->percentEncode($value);
}
$stringToSign = 'GET&%2F&' . $this->percentencode(substr($canonicalizedQueryString, 1));
$signature = base64_encode(hash_hmac('sha1', $stringToSign, $accessKeySecret . '&', true));
$newArray['Signature'] = $signature;
$client = $this->clientFactory->create($options = []);
$url = $this->url . http_build_query($newArray);
$result = $client->request('get', $url);
return json_decode($result->getBody()->getContents(), true);
}
public function sendSms(string $accessKeySecret, $array = array())
{
$array['Action'] = 'SendSms';
return $this->getSign($accessKeySecret, $array);
}
public function phoneNumberJson(string $accessKeySecret, $array = array())
{
$array['Action'] = 'SendBatchSms';
return $this->getSign($accessKeySecret, $array);
}
public function getSendDetails(string $accessKeySecret, $array = array())
{
$array['Action'] = 'QuerySendDetails';
return $this->getSign($accessKeySecret, $array);
}
}
\ No newline at end of file
<?php
namespace App\Task;
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Logger\LoggerFactory;
use App\Model\DevicesModel;
use App\Service\QueueService;
use App\Service\ALiSmsService;
use Hyperf\Utils\ApplicationContext;
class FooTask
{
use \Hyperf\Di\Aop\ProxyTrait;
use \Hyperf\Di\Aop\PropertyHandlerTrait;
/**
* @Inject
* @var QueueService
*/
protected $service;
private $logger;
private $DevicesModel;
private $redisClient;
/**
* @Inject
* @var ALiSmsService
*/
protected $smsphone;
public function __construct(LoggerFactory $loggerFactory, DevicesModel $devicesModel)
{
$this->__handlePropertyHandler(__CLASS__);
$this->logger = $loggerFactory->get('log', 'default');
$container = ApplicationContext::getContainer();
$this->redisClient = $container->get(\Redis::class);
$this->DevicesModel = $devicesModel;
}
public function execute()
{
$data = $this->DevicesModel->devicephone();
if ($data != '') {
$this->jsondata($data);
}
}
//解出 json 字符串
public function jsondata($info)
{
$data = [];
$infos = json_decode($info, true);
foreach ($infos as $key => $value) {
if (substr($value['phone'], 0, 1) == '[') {
$newphone = json_decode($value['phone'], true);
foreach ($newphone as $k => $v) {
$infodata = ['phone' => $v['cphone'], 'devicenum' => substr($value['devicenum'], -3), 'typedevicenum' => $value['devicenum']];
array_push($data, $infodata);
}
} else {
$infodatas = ['phone' => $value['phone'], 'devicenum' => substr($value['devicenum'], -3), 'typedevicenum' => $value['devicenum']];
array_push($data, $infodatas);
}
}
return $this->toarray($data);
}
//
/*二维数组去重*/
public function toarray($data)
{
$public_info = [];
for ($i = 0; $i < count($data); $i++) {
$a = $data[$i];
unset($data[$i]);
if (!in_array($a, $data)) {
$public_info[] = $a;
}
}
return $this->example($public_info);
}
//
/*数组总量进行判断*/
public function example($data)
{
if (count($data) > 1) {
foreach ($data as $key => $value) {
$newdata = ['phone' => $value['phone'], 'devicenum' => $value['devicenum'], 'typedevicenum' => $value['typedevicenum']];
$this->service->push($newdata);
}
} else {
if (!$this->redisClient->get($data['typedevicenum'])) {
$smsdata = $data[0]['phone'];
$template_param = ['cphone' => $data[0]['phone'], 'position' => '您的设备尾号为' . $data[0]['devicenum'], 'alarm' => '离线'];
$typeinfo = $this->smsphone($template_param, $smsdata);
if ($typeinfo['Message'] == 'OK' || $typeinfo['Code'] == 'OK') {
$redisdata = ['data' => $data, 'sendSms' => json_decode($typeinfo, true), 'time' => time()];
$this->redisClient->set($data[0]['typedevicenum'], json_encode($redisdata));
}
}
}
}
public function smsphone($template_param, $phone)
{
$params = array('SignName' => '泽宏云', 'AccessKeyId' => 'LTAI2xiZNF3iV2aV', 'TemplateCode' => 'SMS_169897307', 'PhoneNumbers' => $phone, 'TemplateParam' => json_encode($template_param, JSON_UNESCAPED_UNICODE), 'RegionId' => 'cn-beijing');
return $this->smsphone->sendSms('bprEWwn1M0xgglRQCQEMYSPiYctDk4', $params);
}
}
\ No newline at end of file
<?php
declare (strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Redis;
use Hyperf\Redis\Exception\InvalidRedisConnectionException;
use Hyperf\Redis\Pool\PoolFactory;
use Hyperf\Utils\Context;
/**
* @mixin \Redis
*/
class Redis
{
use \Hyperf\Di\Aop\ProxyTrait;
use \Hyperf\Di\Aop\PropertyHandlerTrait;
use ScanCaller;
/**
* @var PoolFactory
*/
protected $factory;
/**
* @var string
*/
protected $poolName = 'default';
public function __construct(PoolFactory $factory)
{
$this->__handlePropertyHandler(__CLASS__);
$this->factory = $factory;
}
public function __call($name, $arguments)
{
$__function__ = __FUNCTION__;
$__method__ = __METHOD__;
return self::__proxyCall(__CLASS__, __FUNCTION__, self::__getParamsMap(__CLASS__, __FUNCTION__, func_get_args()), function ($name, $arguments) use($__function__, $__method__) {
// Get a connection from coroutine context or connection pool.
$hasContextConnection = Context::has($this->getContextKey());
$connection = $this->getConnection($hasContextConnection);
try {
$connection = $connection->getConnection();
// Execute the command with the arguments.
$result = $connection->{$name}(...$arguments);
} finally {
// Release connection.
if (!$hasContextConnection) {
if ($this->shouldUseSameConnection($name)) {
if ($name === 'select' && ($db = $arguments[0])) {
$connection->setDatabase((int) $db);
}
// Should storage the connection to coroutine context, then use defer() to release the connection.
Context::set($this->getContextKey(), $connection);
defer(function () use($connection) {
Context::set($this->getContextKey(), null);
$connection->release();
});
} else {
// Release the connection after command executed.
$connection->release();
}
}
}
return $result;
});
}
/**
* Define the commands that needs same connection to execute.
* When these commands executed, the connection will storage to coroutine context.
*/
private function shouldUseSameConnection(string $methodName) : bool
{
return in_array($methodName, ['multi', 'pipeline', 'select']);
}
/**
* Get a connection from coroutine context, or from redis connectio pool.
* @param mixed $hasContextConnection
*/
private function getConnection($hasContextConnection) : RedisConnection
{
$connection = null;
if ($hasContextConnection) {
$connection = Context::get($this->getContextKey());
}
if (!$connection instanceof RedisConnection) {
$pool = $this->factory->getPool($this->poolName);
$connection = $pool->get();
}
if (!$connection instanceof RedisConnection) {
throw new InvalidRedisConnectionException('The connection is not a valid RedisConnection.');
}
return $connection;
}
/**
* The key to identify the connection object in coroutine context.
*/
private function getContextKey() : string
{
return sprintf('redis.connection.%s', $this->poolName);
}
}
\ No newline at end of file
[2020-11-27 11:12:03] queue.INFO: [2020-11-27 11:12:03] Processing App\Job\ExampleJob. [] []
[2020-11-27 11:12:03] queue.INFO: [2020-11-27 11:12:03] Processing App\Job\ExampleJob. [] []
[2020-11-27 11:12:03] queue.INFO: [2020-11-27 11:12:03] Processed App\Job\ExampleJob. [] []
[2020-11-27 11:12:03] queue.INFO: [2020-11-27 11:12:03] Processed App\Job\ExampleJob. [] []
[2020-11-27 11:12:03] queue.INFO: [2020-11-27 11:12:03] Processing App\Job\ExampleJob. [] []
[2020-11-27 11:12:03] queue.INFO: [2020-11-27 11:12:03] Processed App\Job\ExampleJob. [] []
================================
🚀 Start @ 2020-11-27 11:11:48
================================
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\RpcClient\Listener\AddConsumerDefinitionListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Paginator\Listener\PageResolverListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\JsonRpc\Listener\RegisterProtocolListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ExceptionHandlerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\DbConnection\Listener\RegisterConnectionResolverListener listener.
[DEBUG] Event Hyperf\Framework\Event\BeforeMainServerStart handled by Hyperf\Amqp\Listener\BeforeMainServerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\BeforeMainServerStart handled by Hyperf\Process\Listener\BootProcessListener listener.
[DEBUG] Event Hyperf\Framework\Event\OnStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[DEBUG] Event Hyperf\Framework\Event\BeforeWorkerStart handled by Hyperf\ConfigAliyunAcm\Listener\BootProcessListener listener.
[DEBUG] Event Hyperf\Framework\Event\BeforeWorkerStart handled by Hyperf\ConfigAliyunAcm\Listener\BootProcessListener listener.
[DEBUG] Event Hyperf\Framework\Event\MainWorkerStart handled by Hyperf\Amqp\Listener\MainWorkerStartListener listener.
[INFO] Worker#0 started.
[INFO] Worker#1 started.
[INFO] HTTP Server listening at 127.0.0.1:9501
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[DEBUG] Event Hyperf\Framework\Event\BeforeWorkerStart handled by Hyperf\ConfigAliyunAcm\Listener\BootProcessListener listener.
[INFO] Worker#2 started.
[DEBUG] Event Hyperf\Framework\Event\BeforeWorkerStart handled by Hyperf\ConfigAliyunAcm\Listener\BootProcessListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[INFO] Worker#3 started.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\ConfigAliyunAcm\Listener\BootProcessListener listener.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[INFO] Process[crontab-dispatcher.0] start.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Process\Listener\LogBeforeProcessStartListener listener.
[DEBUG] Crontab Foo have been registered.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Crontab\Listener\CrontabRegisterListener listener.
[DEBUG] Crontab dispatcher sleep 57s.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\ConfigAliyunAcm\Listener\BootProcessListener listener.
[DEBUG] Event Hyperf\Framework\Event\OnManagerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[INFO] Process[queue.default.0] start.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Process\Listener\LogBeforeProcessStartListener listener.
[DEBUG] Crontab Foo have been registered.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Crontab\Listener\CrontabRegisterListener listener.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\ConfigAliyunAcm\Listener\BootProcessListener listener.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[INFO] Process[queue.default.0] start.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Process\Listener\LogBeforeProcessStartListener listener.
[DEBUG] Crontab Foo have been registered.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Crontab\Listener\CrontabRegisterListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\BeforeHandle handled by App\Listener\QueueHandleListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\BeforeHandle handled by App\Listener\QueueHandleListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\AfterHandle handled by App\Listener\QueueHandleListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\ReloadChannelListener listener.
[DEBUG] Queue lengh of waiting is 1.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\QueueLengthListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\ReloadChannelListener listener.
[DEBUG] Queue lengh of delayed is 0.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\QueueLengthListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\ReloadChannelListener listener.
[WARNING] Queue lengh of failed is 84.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\QueueLengthListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\ReloadChannelListener listener.
[DEBUG] Queue lengh of timeout is 0.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\QueueLengthListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\AfterHandle handled by App\Listener\QueueHandleListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\ReloadChannelListener listener.
[DEBUG] Queue lengh of waiting is 1.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\QueueLengthListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\ReloadChannelListener listener.
[DEBUG] Queue lengh of delayed is 0.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\QueueLengthListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\ReloadChannelListener listener.
[WARNING] Queue lengh of failed is 84.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\QueueLengthListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\ReloadChannelListener listener.
[DEBUG] Queue lengh of timeout is 0.
[DEBUG] Event Hyperf\AsyncQueue\Event\QueueLength handled by Hyperf\AsyncQueue\Listener\QueueLengthListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\BeforeHandle handled by App\Listener\QueueHandleListener listener.
[DEBUG] Event Hyperf\AsyncQueue\Event\AfterHandle handled by App\Listener\QueueHandleListener listener.
[2020-11-27 11:12:14 #48601.4] INFO Server is shutdown now
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Cases;
use HyperfTest\HttpTestCase;
/**
* @internal
* @coversNothing
*/
class ExampleTest extends HttpTestCase
{
public function testExample()
{
$this->assertTrue(true);
$this->assertTrue(is_array($this->get('/')));
}
}
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest;
use Hyperf\Testing\Client;
use PHPUnit\Framework\TestCase;
/**
* Class HttpTestCase.
* @method get($uri, $data = [], $headers = [])
* @method post($uri, $data = [], $headers = [])
* @method json($uri, $data = [], $headers = [])
* @method file($uri, $data = [], $headers = [])
* @method request($method, $path, $options = [])
*/
abstract class HttpTestCase extends TestCase
{
/**
* @var Client
*/
protected $client;
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$this->client = make(Client::class);
}
public function __call($name, $arguments)
{
return $this->client->{$name}(...$arguments);
}
}
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
ini_set('display_errors', 'on');
ini_set('display_startup_errors', 'on');
error_reporting(E_ALL);
date_default_timezone_set('Asia/Shanghai');
! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
! defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', SWOOLE_HOOK_ALL);
Swoole\Runtime::enableCoroutine(true);
require BASE_PATH . '/vendor/autoload.php';
Hyperf\Di\ClassLoader::init();
$container = require BASE_PATH . '/config/container.php';
$container->get(Hyperf\Contract\ApplicationInterface::class);
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitfe4aa758bb52353ebd02381912b88cc6::getLoader();
../nesbot/carbon/bin/carbon
\ No newline at end of file
../hyperf/testing/co-phpunit
\ No newline at end of file
../friendsofphp/php-cs-fixer/php-cs-fixer
\ No newline at end of file
../nikic/php-parser/bin/php-parse
\ No newline at end of file
../phpstan/phpstan/phpstan
\ No newline at end of file
../phpstan/phpstan/phpstan.phar
\ No newline at end of file
../phpunit/phpunit/phpunit
\ No newline at end of file
This diff is collapsed.
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
This diff is collapsed.
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'9b38cf48e83f5d8f60375221cd213eee' => $vendorDir . '/phpstan/phpstan/bootstrap.php',
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
'bbeb7603826cb9296dde3ca1a840af47' => $vendorDir . '/hyperf/utils/src/Functions.php',
'fe1d4898277c26748a003292f432cd3b' => $vendorDir . '/jetbrains/phpstorm-stubs/PhpStormStubsMap.php',
'46a9bb9cbc7a6a5c34938373dbe690c3' => $vendorDir . '/hyperf/di/src/Functions.php',
'7e9bd612cc444b3eed788ebbe46263a0' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/autoload.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'253c157292f75eb38082b5acb06f3f01' => $vendorDir . '/nikic/fast-route/src/functions.php',
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php',
'870c221a18597bfcd5ed576d0fb64a19' => $vendorDir . '/opentracing/opentracing/src/OpenTracing/Tags.php',
'd25d883add1ecab0d3a9ffec57f0f183' => $vendorDir . '/opentracing/opentracing/src/OpenTracing/Formats.php',
'198ca788260cba849b8d9061ef2afeb7' => $vendorDir . '/openzipkin/zipkin/src/Zipkin/Propagation/Id.php',
'1078d5a0858ccde97f683b735c9f5473' => $vendorDir . '/openzipkin/zipkin/src/Zipkin/Timestamp.php',
'948c9b6b6a769d2db468357f07afb9ed' => $vendorDir . '/openzipkin/zipkin/src/Zipkin/Kind.php',
'f99ca7ab6b69ea13de674def3146fa4b' => $vendorDir . '/openzipkin/zipkin/src/Zipkin/Tags.php',
'809f512612033e8c2eaab5c48aa38d39' => $vendorDir . '/openzipkin/zipkin/src/Zipkin/Annotations.php',
'fdea4480df6c5882835d3b60a113de4d' => $vendorDir . '/hyperf/config/src/Functions.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
);
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Mockery' => array($vendorDir . '/mockery/mockery/library'),
);
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/reflection-docblock/src', $vendorDir . '/phpdocumentor/type-resolver/src'),
'Zipkin\\' => array($vendorDir . '/openzipkin/zipkin/src/Zipkin'),
'ZipkinOpenTracing\\' => array($vendorDir . '/jcchavezs/zipkin-opentracing/src/ZipkinOpenTracing'),
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'),
'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'),
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'),
'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'),
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
'Symfony\\Component\\Stopwatch\\' => array($vendorDir . '/symfony/stopwatch'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
'Roave\\Signature\\' => array($vendorDir . '/roave/signature/src'),
'Roave\\BetterReflection\\' => array($vendorDir . '/roave/better-reflection/src'),
'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Server\\' => array($vendorDir . '/psr/http-server-handler/src', $vendorDir . '/psr/http-server-middleware/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src/Prophecy'),
'Phper666\\HyperfServiceCommand\\' => array($vendorDir . '/phper666/hyperf-server-command/src'),
'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'),
'PhpCsFixer\\' => array($vendorDir . '/friendsofphp/php-cs-fixer/src'),
'PhpAmqpLib\\' => array($vendorDir . '/php-amqplib/php-amqplib/PhpAmqpLib'),
'Overtrue\\EasySms\\' => array($vendorDir . '/overtrue/easy-sms/src'),
'OpenTracing\\' => array($vendorDir . '/opentracing/opentracing/src/OpenTracing'),
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
'MathPHP\\' => array($vendorDir . '/markrogoyski/math-php/src'),
'Laminas\\ZendFrameworkBridge\\' => array($vendorDir . '/laminas/laminas-zendframework-bridge/src'),
'Laminas\\Stdlib\\' => array($vendorDir . '/laminas/laminas-stdlib/src'),
'Laminas\\Mime\\' => array($vendorDir . '/laminas/laminas-mime/src'),
'Hyperf\\Utils\\' => array($vendorDir . '/hyperf/utils/src'),
'Hyperf\\Tracer\\' => array($vendorDir . '/hyperf/tracer/src'),
'Hyperf\\Testing\\' => array($vendorDir . '/hyperf/testing/src'),
'Hyperf\\Server\\' => array($vendorDir . '/hyperf/server/src'),
'Hyperf\\Rpc\\' => array($vendorDir . '/hyperf/rpc/src'),
'Hyperf\\RpcServer\\' => array($vendorDir . '/hyperf/rpc-server/src'),
'Hyperf\\RpcClient\\' => array($vendorDir . '/hyperf/rpc-client/src'),
'Hyperf\\Redis\\' => array($vendorDir . '/hyperf/redis/src'),
'Hyperf\\Process\\' => array($vendorDir . '/hyperf/process/src'),
'Hyperf\\Pool\\' => array($vendorDir . '/hyperf/pool/src'),
'Hyperf\\Paginator\\' => array($vendorDir . '/hyperf/paginator/src'),
'Hyperf\\ModelListener\\' => array($vendorDir . '/hyperf/model-listener/src'),
'Hyperf\\ModelCache\\' => array($vendorDir . '/hyperf/model-cache/src'),
'Hyperf\\Memory\\' => array($vendorDir . '/hyperf/memory/src'),
'Hyperf\\Logger\\' => array($vendorDir . '/hyperf/logger/src'),
'Hyperf\\LoadBalancer\\' => array($vendorDir . '/hyperf/load-balancer/src'),
'Hyperf\\JsonRpc\\' => array($vendorDir . '/hyperf/json-rpc/src'),
'Hyperf\\HttpServer\\' => array($vendorDir . '/hyperf/http-server/src'),
'Hyperf\\HttpMessage\\' => array($vendorDir . '/hyperf/http-message/src'),
'Hyperf\\Guzzle\\' => array($vendorDir . '/hyperf/guzzle/src'),
'Hyperf\\Framework\\' => array($vendorDir . '/hyperf/framework/src'),
'Hyperf\\ExceptionHandler\\' => array($vendorDir . '/hyperf/exception-handler/src'),
'Hyperf\\Event\\' => array($vendorDir . '/hyperf/event/src'),
'Hyperf\\Elasticsearch\\' => array($vendorDir . '/hyperf/elasticsearch/src'),
'Hyperf\\Dispatcher\\' => array($vendorDir . '/hyperf/dispatcher/src'),
'Hyperf\\Di\\' => array($vendorDir . '/hyperf/di/src'),
'Hyperf\\Devtool\\' => array($vendorDir . '/hyperf/devtool/src'),
'Hyperf\\DbConnection\\' => array($vendorDir . '/hyperf/db-connection/src'),
'Hyperf\\Database\\' => array($vendorDir . '/hyperf/database/src'),
'Hyperf\\Crontab\\' => array($vendorDir . '/hyperf/crontab/src'),
'Hyperf\\Contract\\' => array($vendorDir . '/hyperf/contract/src'),
'Hyperf\\Constants\\' => array($vendorDir . '/hyperf/constants/src'),
'Hyperf\\Config\\' => array($vendorDir . '/hyperf/config/src'),
'Hyperf\\ConfigAliyunAcm\\' => array($vendorDir . '/hyperf/config-aliyun-acm/src'),
'Hyperf\\Command\\' => array($vendorDir . '/hyperf/command/src'),
'Hyperf\\Cache\\' => array($vendorDir . '/hyperf/cache/src'),
'Hyperf\\AsyncQueue\\' => array($vendorDir . '/hyperf/async-queue/src'),
'Hyperf\\Amqp\\' => array($vendorDir . '/hyperf/amqp/src'),
'HyperfTest\\' => array($baseDir . '/test'),
'GuzzleHttp\\Stream\\' => array($vendorDir . '/ezimuel/guzzlestreams/src'),
'GuzzleHttp\\Ring\\' => array($vendorDir . '/ezimuel/ringphp/src'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Fig\\Http\\Message\\' => array($vendorDir . '/fig/http-message-util/src'),
'FastRoute\\' => array($vendorDir . '/nikic/fast-route/src'),
'Elasticsearch\\' => array($vendorDir . '/elasticsearch/elasticsearch/src/Elasticsearch'),
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Inflector'),
'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer'),
'Doctrine\\Common\\Annotations\\' => array($vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations'),
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
'App\\' => array($baseDir . '/app'),
);
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitfe4aa758bb52353ebd02381912b88cc6
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitfe4aa758bb52353ebd02381912b88cc6', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitfe4aa758bb52353ebd02381912b88cc6', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitfe4aa758bb52353ebd02381912b88cc6::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitfe4aa758bb52353ebd02381912b88cc6::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirefe4aa758bb52353ebd02381912b88cc6($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequirefe4aa758bb52353ebd02381912b88cc6($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}
This diff is collapsed.
This diff is collapsed.
name: "Continuous Integration"
on:
- push
- pull_request
env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"
jobs:
tests:
name: "CI"
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "5.3"
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Choose PHPUnit version"
run: |
if [ "${{ matrix.php-version }}" = "7.4" ]; then
echo "SYMFONY_PHPUNIT_VERSION=7.5" >> $GITHUB_ENV;
elif [ "${{ matrix.php-version }}" = "8.0" ]; then
echo "SYMFONY_PHPUNIT_VERSION=9.4" >> $GITHUB_ENV;
fi
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: "Install latest dependencies"
run: |
# Remove PHPStan as it requires a newer PHP
composer remove phpstan/phpstan --dev --no-update
composer update ${{ env.COMPOSER_FLAGS }}
- name: "Run tests"
run: "vendor/bin/simple-phpunit --verbose"
name: "PHP Lint"
on:
- push
- pull_request
jobs:
tests:
name: "Lint"
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "5.3"
- "7.4"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: "Lint PHP files"
run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"
name: "PHPStan"
on:
- push
- pull_request
env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
SYMFONY_PHPUNIT_VERSION: ""
jobs:
tests:
name: "PHPStan"
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "7.4"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: "Install latest dependencies"
run: "composer update ${{ env.COMPOSER_FLAGS }}"
- name: Run PHPStan
# Locked to phpunit 7.5 here as newer ones have void return types which break inheritance
run: |
composer require --dev phpunit/phpunit:^7.5.20 --with-all-dependencies ${{ env.COMPOSER_FLAGS }}
vendor/bin/phpstan analyse
This diff is collapsed.
Copyright (C) 2015 Composer
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment