Re: Command line PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 7, 2011, at 1:34 PM, TR Shaw wrote:

> 
> On Jan 7, 2011, at 12:08 PM, Nicholas Kell wrote:
> 
>> 
>> On Jan 7, 2011, at 11:01 AM, Joshua Kehn wrote:
>> 
>>> On Jan 7, 2011, at 11:55 AM, larry@xxxxxxxxxxxxxxxx wrote:
>>> 
>>>> Hi folks.  I have a project coming up that will involve writing a non-trivial command line PHP application.  Most of it will be nice and abstracted and standalone and all of that jazz, but it will need to do command line interation.  I'm not sure yet if it will be interactive or if I just need to parse lots of command line switches.
>>>> 
>>>> Has anyone used a CLI-handling library they like?  I recall briefly using the PEAR CLI library many many years ago and disliking it because it was only barely a step above the raw PHP-CLI SAPI, and still required lots of if-else branching in my code.  I don't know if there's anything better since then, however.  I prefer clean OO to procedural, but can work with procedural if needs be.  The fewer dependencies it has the better as well.
>>>> 
>>>> Any recommendations?
>>>> 
>>>> (Open source, GPLv2-compatible required.)
>>>> 
>>>> --Larry Garfield
>>> 
>>> Larry-
>>> 
>>> Why are you writing a command line application in PHP? I would think that is starting off on a very wrong foot. 
>>> 
>>> Can you explain the requirements / use cases a bit more?
>>> 
>> 
>> I agree. Not saying that it isn't doable, because it certainly is, but there may be other languages that are available and easier to implement a CLI app, such as Python, or some other QnD scripting language.
> 
> Pardon me but what's the big deal?
> 
> Put a shebang up top and then add:
> 
> 

[code]
[/snip]


There isn't a big deal. If PHP is the only suitable tool you have, go for it. There are plenty of ways to do this. 

My natural first reaction is to write it in Python, Ruby or something else. But thats me - my personal toolbox is chock full of languages. PHP only being one of them.

That being said, have I ever written a CLI app in PHP - sure whenever I need a quick and dirty to move a few thousand records, or whatever, why not. 

As the OP has said (After my comment) his PHP-fu is strong, whereas in other languages are not. This in my humble opinion is the perfect time to use PHP. 

Do I ever see one language to be the end all be all for every application? No, absolutely not. 
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux