php-mvc-framework icon indicating copy to clipboard operation
php-mvc-framework copied to clipboard

Added a feature to serve the app using the terminal command 'php codeholic serve'

Open aditya-zanjad opened this issue 3 years ago • 3 comments

Added an alternate way to serve the app using the terminal command php codeholic serve

From the root directory, where README.md file is located, you can now run the following terminal command to serve the app.

php codeholic serve

FIRST NOTE The file codeholic.php has been renamed to just codeholic. This way we can just run php codeholic serve instead of php codeholic.php serve.


SECOND NOTE In the fourth commit, added the ability to specify port number & host url for the command php codeholic serve. Now, we can specify parameters '--port' & '--host'. If the user does not provide any value for --port argument, then its default value will always be 8080.

Some examples below:

php codeholic serve --host=localhost --port=8081
php codeholic serve --host=127.0.0.1
php codeholic serve --port=5000

THIRD NOTE In the seventh commit, added the option to specify the parameter --max-port to decide the limit upto which to try to run the PHP's built-in server on before showing a failure message. The value of the parameter --max-port should always be equal to or greater than the value of the parameter --port.

If the user does not provide any value for --port argument, then its default value will always be 8080.

Also, there is a hard limit set on the value of --max-port. This means, the value of --max-port should never be greater than the addition of value of --port plus 100. This is done to make sure that the for loop in the program will not like run forever.

Some valid examples below:

php codeholic serve --max-port=8180
php codeholic serve --port=9000 --max-port=9100

Some invalid examples below:

php codeholic serve --max-port=9000
php codeholic serve --port=9000 --max-port=10000

aditya-zanjad avatar Apr 27 '22 10:04 aditya-zanjad

That is awesome @aditya-zanjad. Thank you for it. I will test it and as far as there are no issue I will merge this.

thecodeholic avatar Jul 18 '22 08:07 thecodeholic

@thecodeholic Thank you for the feedback. The suggested changes are now implemented. Thank you.

aditya-zanjad avatar Sep 26 '22 10:09 aditya-zanjad

@aditya-zanjad Thank you for this. I will review it and test and then merge if everything looks good. I love the feature. Well Done.

thecodeholic avatar Sep 26 '22 10:09 thecodeholic