Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-20 Thread Hammed Ajao
On Tue, Nov 19, 2024, 6:38 a.m. Bilge wrote: > On 19/11/2024 13:26, John D'Orazio wrote: > > I don't understand why an application should not know which > > environment it is running in? > > I don't know if this list is the place to be discussing this, but here > goes: > > Typically you are injec

Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-19 Thread Bilge
On 19/11/2024 23:14, Rowan Tommins [IMSoP] wrote: On 19/11/2024 13:48, Hammed Ajao wrote: So if symfony and laravel do this, whose best practices are we going by exactly, yours? One common citation for this is "The Twelve-Factor App" [https://12factor.net/], a methodology/manifesto publish

Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-19 Thread Rowan Tommins [IMSoP]
On 19/11/2024 13:48, Hammed Ajao wrote: So if symfony and laravel do this, whose best practices are we going by exactly, yours? One common citation for this is "The Twelve-Factor App" [https://12factor.net/], a methodology/manifesto published in 2011 by some engineers from Heroku as a way

Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-19 Thread John D'Orazio
I don't understand why an application should not know which environment it is running in? You should be able to instruct a frontend where to look for a backend, depending on the environment it is running in. What best practice are you referring to? And may I ask why the PHP built-in server was crea

Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-19 Thread John D'Orazio
> Why couldn't you just do>> ```php> if (php_sapi_name() === 'cli-server') {>     $_ENV['APP_ENV'] = 'development';> }> ```>> in your entry point script?In fact this is pretty much how I currently handle the situation. Of course it can be handled in the entry point script.My point is, would the bui

Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-19 Thread Bruce Weirdan
> I think it would be a nice feature of PHP's built-in server to do something similar, automatically provide a `$_ENV[APP_ENV]` variable with a value of `development` so that the application logic knows whether it's running on a localhost development environment rather than on a production server.

Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-19 Thread Bilge
On 19/11/2024 13:26, John D'Orazio wrote: I don't understand why an application should not know which environment it is running in? I don't know if this list is the place to be discussing this, but here goes: Typically you are injecting the environment name to have the application switch to a

Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-19 Thread Bilge
On 19/11/2024 12:52, John D'Orazio wrote: My point is, would the built-in server ever be used for anything other than local development? If not, then it would be a simple convenience to developers to have an automatic environment variable of "development" when launching the built-in server. Ins

Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-19 Thread John D'Orazio
Sorry for the typo, I meant to write 'LAMP'. I have always setup a Linux Apache MySQL PHP environment for local development. But I find that not everyone is so keen on such an involved local setup. Which is why I find the built-in server such a great convenience. It greatly simplifies the developme

Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-19 Thread Christoph M. Becker
On 19.11.2024 at 03:33, John D'Orazio wrote: > […] I even recently discovered the great > feature that was introduced in PHP 7.4 `PHP_CLI_SERVER_WORKERS`, which I > sorely > needed because my API makes a couple of requests internally to various paths > of > the API, and nested requests require m