Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Conversation

@kocoten1992
Copy link
Contributor

Previously, there is no way (?) to hook up and run a script before http start.

This patch allowed user to extends our class with hookAction run custom script before starting server up.

allow user to run custom script before starting server up
@Arkanius Arkanius merged commit 67203c6 into swooletw:master Mar 3, 2021
@leocarmo
Copy link

Good! There is an example to show how i can implement this on a right way?

@kocoten1992
Copy link
Contributor Author

@leocarmo you can extends it normally, it will overwrite the default command

<?php
    
namespace App\Console\Commands;
      
use SwooleTW\Http\Commands\HttpServerCommand;
      
class TestCommand extends HttpServerCommand
{
    protected $signature = 'swoole:http {action : start|stop|restart|reload|infos}';

    protected function hookAction()
    {
        echo 'hook between init and run';
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants