Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

feat: add hook action for http server #469

Merged
merged 1 commit into from
Mar 3, 2021

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