🚀 Developing Rocketseat's Next Level Week (NLW#05) Application using PHP/Swoole + Hyperf

Overview

Inmana PHP

🚀 Developing Rocketseat 's Next Level Week (NLW#05) Application using Swoole + Hyperf.

This is the app of the Elixir track.

I know PHP/Swoole I know NLW#5
The Next Level Week is a sprint promoted by the education company Rocketseat to help in the learning of new technologies. Unfortunately they don't officially support a PHP track, but we love PHP specially when it comes with Swoole. This is the following of the Elixir track, but using Swoole (instead of regular PHP-FPM), a high-performance server for PHP applications inspired on Erlang, and Hyper, a MVC framework analog to Phoenix, that supports Coroutines as first-class.

Comparison table

Language Runtime Framework ORM
From Elixir Processes (Tasks/GenServer) Phoenix Ecto
To PHP Swoole Coroutines/Fibers Hyperf Hyperf-Eloquent

For the REPL (iex) you can use gokure/hyperf-tinker.

The mail component for Elixir was based on the third-party Bamboo project, same here, it uses hyperf-ext/mail (both running locally with logs, but with a wide range of transports/adapters available).

Check /runtime/logs/hyperf.log for sent emails.

Trying out

Up development environment

docker compose run --rm --service-ports app

This will start an interactive shell inside a container-based development environment.
The following commands should be executed inside this shell session.

If you don't want to use Docker you can skip this step, just make sure you have a running MySQL server, PHP 7.4 and Swoole 4.6.

Install dependencies

composer install

Configure

Make sure to change .env for proper values (like setting DB_HOST to db if in Docker) and adding passwords.

Run migrations

php bin/hyperf.php migrate

Start the server (and watch for changes)

php bin/hyperf.php server:watch

Trigger expiring emails

php bin/hyperf.php mail:expiring

After that, see runtime/logs/hyperf.log

You might also like...
Jin microservices is a complete microservice demo based on PHP language + hyperf microservices framework
Jin microservices is a complete microservice demo based on PHP language + hyperf microservices framework

介绍 Jin-microservices是基于 php 语言 + hyperf 微服务 框架的完整微服务demo。 github:https://github.com/Double-Jin/jin-microservices gitee:https://gitee.com/ljj96/jin-mic

An issue tracking tool based on hyperf+reactjs for small and medium-sized enterprises, open-source and free, similar to Jira.
An issue tracking tool based on hyperf+reactjs for small and medium-sized enterprises, open-source and free, similar to Jira.

介绍 本项目以 actionview 为蓝本,使用 Hyperf 框架进行重写。 本项目为 Hyperf 框架的 DEMO 项目 原 ActionView 介绍 English | 中文 一个类Jira的问题需求跟踪工具,前端基于reactjs+redux、后端基于php laravel-frame

🎲 This project provides an integration for the Doctrine ORM and the Hyperf framework

Hyperf 🤝 Doctrine This project provides an integration for the Doctrine ORM and the Hyperf framework. Install composer require leocavalcante/hyperf-d

This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on Swoole.
This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on Swoole.

This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on Swoole.

Zephir is a compiled high level language aimed to the creation of C-extensions for PHP.

Zephir - is a high level programming language that eases the creation and maintainability of extensions for PHP. Zephir extensions are exported to C c

:gem: Go! AOP PHP - modern aspect-oriented framework for the new level of software development

Go! Aspect-Oriented Framework for PHP Go! AOP is a modern aspect-oriented framework in plain PHP with rich features for the new level of software deve

PHP Kafka client is used in PHP-FPM and Swoole. PHP Kafka client supports 50 APIs, which might be one that supports the most message types ever.

longlang/phpkafka Introduction English | 简体中文 PHP Kafka client is used in PHP-FPM and Swoole. The communication protocol is based on the JSON file in

一个极简高性能php框架,支持[swoole | php-fpm ]环境

One - 一个极简高性能php框架,支持[swoole | php-fpm ]环境 快 - 即使在php-fpm下也能1ms内响应请求 简单 - 让你重点关心用one做什么,而不是怎么用one 灵活 - 各个组件松耦合,可以灵活搭配使用,使用方法保持一致 原生sql可以和模型关系with搭配使用,

球球大作战(PHP+Swoole)
球球大作战(PHP+Swoole)

球球大作战 在线多人H5游戏(H5客户端, 服务端) W A S D 控制 技术栈: PHP7.4+ Swoole4.6(多进程, WebSocket, 共享内存) SpriteJS v3(2D Canvas渲染) 演示Demo 安装: 环境要求:Linux,PHP7.4+(启用Swoole拓展)

Owner
Leo Cavalcante
PHP Software Engineer @PicPay & @swoole Evangelist
Leo Cavalcante
💫 Vega is a CLI mode HTTP web framework written in PHP support Swoole, WorkerMan / Vega 是一个用 PHP 编写的 CLI 模式 HTTP 网络框架,支持 Swoole、WorkerMan

Mix Vega 中文 | English Vega is a CLI mode HTTP web framework written in PHP support Swoole, WorkerMan Vega 是一个用 PHP 编写的 CLI 模式 HTTP 网络框架,支持 Swoole、Work

Mix PHP 46 Apr 28, 2022
Multi-process coroutine edition Swoole spider !! Learn about Swoole's network programming and the use of its related APIs

swoole_spider php bin/spider // Just do it !! Cache use Swoole\Table; use App\Table\Cache; $table = new Table(1<<20); // capacity size $table->column

null 3 Apr 22, 2021
A easy way to install your basic yii projetc, we have encrypt database password in phpfile, my class with alot funtions to help you encrypt and decrypt and our swoole server install just run ./yii swoole/start and be happy!

Yii 2 Basic Project Template with swoole and Modules Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small proj

null 3 Apr 11, 2022
swoole,easyswoole,swoole framework

EasySwoole - A High Performance Swoole Framework EasySwoole is a distributed, persistent memory PHP framework based on the Swoole extension. It was cr

null 4.6k Jan 2, 2023
swoole and golang ipc, use goroutine complete swoole coroutine

swoole and golang ipc demo swoole process module exec go excutable file as sider car, use goroutine complete swoole coroutine hub.php <?php require '

null 2 Apr 17, 2022
🔭 Proof of concept on adding observability features (tracing and metrics) to a Nano microservice (using existing Hyperf components).

?? Tracing Nano Proof of concept on adding observability features (tracing and metrics) to a Nano microservice (using existing Hyperf components ?? ).

Leo Cavalcante 4 Oct 24, 2022
A sample CakePHP api application using CakeDC/cakephp-api and swoole as server

CakePHP Application Skeleton composer create-project --prefer-dist cakephp/app Added sample data using https://github.com/annexare/Countries Created m

Marcelo Rocha 3 Jul 28, 2022
🚀Hyperf is an extremely performant and flexible PHP CLI framework

Hyperf is an extremely performant and flexible PHP CLI framework, powered by a state-of-the-art coroutine server and a large number of battle-tested components. Aside from decisively beating PHP-FPM frameworks in benchmarks, Hyperf is unique in its focus on flexibility and composition.

Hyperf 4.9k Dec 30, 2022
Hyperf is an extremely performant and flexible PHP CLI framework

?? A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.

Hyperf 5k Jan 4, 2023