Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How do you code in PHP?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How do you code in PHP?

LeviLevi Member

What are you usually using when coding in PHP? Pure PHP or some kind of framework?

«1

Comments

  • FalzoFalzo Member

    nano / notepad++

  • GaleejGaleej Member

    Laravel + VSCODE

  • deankdeank Member, Troll

    Drink two bottles of vodka in 5 minutes, sit in front of a computer, open the notepad++.

    Half a day later, you will wake up on your bed and find your coding complete on the computer.

    Dat's how ya code.

    Thanked by 3Levi TheKiller notarobo
  • LeviLevi Member

    @deank said: Drink two bottles of vodka

    Brand doesn't matter? Absolut or any other?

  • Visual Studio Code during nights.

  • deankdeank Member, Troll
    edited July 2020

    @LTniger said:
    Brand doesn't matter? Absolut or any other?

    Brand matters not! It's vodka! The soul drink of Russians.

  • NeoonNeoon Community Contributor, Veteran
    edited July 2020

    Not in the early morning or very late evening.
    Not without the buildserver permission.
    The buildserver is king.

    Atom Editor 4 ever.
    Vanilla rulez, using a framework is like having sex with a condom but expecting a child.

  • @deank said: Drink two bottles of vodka

    Vodka? Just take a bottle or two of Polmos Spirytus Rektyfikowany (96% ABV). Around 3 weeks later after you wake up you'll find that you've completed all of your incomplete development projects from the last four years!

  • Meh. Just drink самогон (almost like moonshine but not really). You'll never get sober again. You wake up the next day, drink a glass of water and voila! You're drunk again. All your php worries are done for.

  • nemnem Member, Host Rep

    Laravel for framework. PHPStorm + WSL for IDE.

  • raindog308raindog308 Administrator, Veteran

    @LTniger said: What are you usually using when coding in PHP?

    Antidepressants.

  • Sorry, I use java and golang.

  • UmutUmut Member

    Notepad++

  • PhpStorm

  • simple framework like thing developed by my own with vscode. Here is the link to the project if anyone interested http://github.com/avanciro/skel ( PR's welcome, because my code is bad and I know it :lol: )

  • Vi, mostly but sometimes the 'legacy' cPanel file editor.

  • Jona4sJona4s Member

    PHP is actually a framework of C, called Zend.

    It was made for people who find it difficult to understand a compiled language like C, Rust or Go.

    You are paying a high price in terms of performance, for the syntax sugar of PHP. Things such as spawning a thread per request introduces context switching and syscalls which makes PHP one of the worst performing languages for servers (1)

    https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext

  • @LTniger said:
    What are you usually using when coding in PHP?

    Profanity.

    foreach ($fucks as $fuck) {
    if ( $fuck > $givemore ) {
    $givemore = $fuck;
    }
    //TODO: Give as much of a fuck about this script as I fucking can. Nobody gonna see it except me.
    }

    escape colon ex

    Thanked by 1noaman
  • CConnerCConner Member, Host Rep

    @Jona4s said:
    PHP is actually a framework of C, called Zend.

    It was made for people who find it difficult to understand a compiled language like C, Rust or Go.

    You are paying a high price in terms of performance, for the syntax sugar of PHP. Things such as spawning a thread per request introduces context switching and syscalls which makes PHP one of the worst performing languages for servers (1)

    https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext

    Seems that issue will largely get solved by the introduction of the JIT compiler https://medium.com/jp-tech/try-out-jit-compiler-with-php-8-0-a020e6aeb3e5

  • CrabCrab Member

    Notepad++ with SFTP plugin is the way to go. Of course vodka will help throughout your journey.

    Thanked by 1mrTom
  • Adam1Adam1 Member

    phpDesigner

  • SplitIceSplitIce Member, Host Rep

    I only use PHP for the one project. This project was started well before NodeJS and even before the popularity of most of the current PHP frameworks. These days if I was to redevelop it (unlikely to happen) I would do an API first design in NodeJS. For any serious new endevour I would do the same (I might still use PHP for a small hacked together project w/o serious need for API).

    This one project uses it's own framework. The framework it uses was born from the projects I was developing at that time (including this one).

    Today however I would definitely develop any PHP project in a modern open source framework. I have no particular preference (research would be required). I would certainly prioritize something minimal, component driven and obeying PSR standards with composer compatible autoloading.

    @Jona4s PHP performs well enough for many peoples needs.

    I've scaled my web cluster out to 2x web nodes (only for redundancy) and 3x backend nodes (PHP job queue). Memory has always been the bigger issue than raw performance - and on that front I've found PHP to do better than most NodeJS applications (primarily due to the consistency & predictability of the process based model) along with the entire clearing of (non shm) memory at end of process.

    I'm looking forward to PHP 8.0 for the backend job queue but not the web side. Why? Because the web side is already fast enough. Some of the work we do on the backend nodes is heavy number processing which is not PHP's strong suit (VM overheads). I've played with PHP8.0 and preliminary results look good (~+30%).


    As with everything, choose the right tool for the job.

    Doing a high performance api or microservice?
    Start by looking into Lua (openresty), Rust or NodeJS depending on your performance requirements and available resources.

    Doing a simple stand alone website?
    PHP or NodeJS are both good choices with different pros and cons.

    Doing something with lots of backend work between requests or websockets?
    NodeJS is very strong in this area.

    Oh and never Ruby :s

  • CConnerCConner Member, Host Rep

    @SplitIce I wouldn't use Node for anything that needs to do the heavy lifting, mainly due to the execution being single-threaded. You can of course use the new worker threads API but it's far from perfect with no memory sharing being available.

    From my experience with building GameDash that mainly uses PHP in the backend to provide an API for the rest of the services to talk to, I would use Kotlin/Java.

  • SplitIceSplitIce Member, Host Rep
    edited July 2020

    @CConner

    It might be different in your space but in the professional spaces I consult in most services (including NodeJS based) deployed are built to be horizontally scalable. Usually via multiple processes, sometimes via webworkers.

    NodeJS is often more optimal for anything that needs to heavy lifting due to the relatively low costs of keeping a request open in a well tuned application. No entire thread / process and per request VM instance (with code, stack and globals) to keep in memory. Hell many applications can achieve 2-3 simultaneous requests at 100% speed per process just from the time spent querying data sources like SQL databases.

    The biggest issues I have seen with NodeJS have been:

    • Applications with in proper exception handling and defects can have issues that affect all requests in flight (e.g OOM or crash the process).
    • Difficulty predicting resource usage and (IMHO) seemingly higher than PHP typical memory requirements
    • Legacy applications (or modules) and callback hell. And unhandled rejections (incorrect or incomplete exception handling) in promise based ones.

    If you give a NodeJS a comparable number of processes to your PHP application (up to number of cpu cores +/- 1 depending on particular case) and use a decent load balancer I would be surprised if you did not achieve better performance (responsiveness, ttfb or req/s) with NodeJS over PHP.

    But you should ask yourself if it matters. It's no more than $5 for a 1core/1GB virtual machine in the (non AWS) cloud these days. Kubernetes options are nearly as cheap too. As long as you can horizontally scale your application professionally it's an easy sell to spin up 32, 64 or even 128 of these instances. It's unlikely to even be a drop in the project budget bucket. You will likely have more serious issues scaling your databases.

    Memory on the other hand has more commonly been an issue with NodeJS applications I've seen. I've seen a project which required 4-8GB instances just to run due to localized peaks. Now those were a different story ($$$$$/m on AWS for the cluster)...

  • LeviLevi Member

    Guys, keep thread clean from "x is better than PHP".

    Thanked by 3Adam1 muratai imok
  • FalzoFalzo Member

    @LTniger said:
    Guys, keep thread clean from "x is better than PHP".

    It became a habit to complain about php a lot. People do that on all sorts of forums like vanilla, discourse and even blog about it on their own wordpress. How about not using it then? Oh... wait.

    Thanked by 2serv_ee mrTom
  • @Falzo said:

    @LTniger said:
    Guys, keep thread clean from "x is better than PHP".

    It became a habit to complain about php a lot. People do that on all sorts of forums like vanilla, discourse and even blog about it on their own wordpress. How about not using it then? Oh... wait.

    This.

  • CConnerCConner Member, Host Rep
    edited July 2020

    @SplitIce Yeah, the space you're working is a lot different compared to mine, considering I am working on a product for mass consumption rather than an architected business solution. Why I personally would not choose PHP for a project again is because it lacks some higher-level features such as full static type support (generics, arrays), enums, and threads with memory sharing.

    As you said yourself, the choice of language isn't important if that is deemed to be the right tool for the job.

    As with any language that has a higher than normal % of beginner programmers, people shit on the language rather than the people who write it.

    ps. I would keep an eye on https://deno.land/ - using it for a small app and it does pretty much everything better than node.

Sign In or Register to comment.