Skip to content

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

Notifications You must be signed in to change notification settings

leocavalcante/inmana-php

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Languages