2021-03-19
1468
#js libraries#php
Kenneth Ekandem
37731
Mar 19, 2021 ⋅ 5 min read

Getting started with JavaScript for PHP developers

Kenneth Ekandem Software engineer with four years' experience in PHP and JavaScript. Currently working as a backend developer for Codekago Interactive.

Recent posts:

Why Go wasn’t the right choice for the TypeScript compiler

Why Go wasn’t the right choice for the TypeScript compiler

The switch to Go may be a pragmatic move in the short term, but it risks alienating the very developers who built the tools that made TypeScript indispensable in the first place.

Muhammed Ali
May 8, 2025 ⋅ 4 min read
how and when to use type casting in TypeScript

How and when to use type casting in TypeScript

Discover the basics and advanced use cases of type casting, how and why to use it to fix type mismatches, and gain some clarity on casting vs. assertion.

Paul Akinyemi
May 8, 2025 ⋅ 14 min read

How to format dates in JavaScript: Methods, libraries, and best practices

JavaScript date handling can be tough. Here are some native Date API tools and specialized libraries to tackle them with.

Nelson Michael
May 8, 2025 ⋅ 8 min read
tailwind typography

How to use the Tailwind Typography plugin

Walk you through how to set up and use the Tailwind Typography plugin, also known as the @tailwindcss/typography or the prose plugin.

David Omotayo
May 7, 2025 ⋅ 7 min read
View all posts

6 Replies to "Getting started with JavaScript for PHP developers"

  1. Migrating from php to JavaScript. One of the best frameworks to go for is Expresswebjs which enables you to build structured, secured and scalable application.

  2. Laravel livewire or Laravel+inertia.js is the way to go for me, but 9/10 times Livewire wins. Most of the points you pointed out can easily be challenged when you need third party functionality such as import/export csv,authentication, charting, oauth, pdf generation. All of this is easily done with Laravel, but not so easily with a JS backend solution, i’ve done projects in both sides, im glad i found Livewire, i drastically reduced js code in my aplications and whenever i need it, alpine.js does the rest of the job. If i work with inertia.js, Laravel still helps tremendously because i dont have to write any api like in a classical api project, Laravel is the workhorse providing the data, handling authentication… etc, then vue.js is for the front end receiving data from Laravel as props. But still working with Livewire handles all of this with less code and dont have to go through some annoying stuff that vue.js has. The only time where i would only use a pure JS solution will be if the app is a chat app, a prodict builder with a rich UI which changes on every click and event or a social media app like facebook, which is the reason why they created React, because that solves their problem.

  3. You highlight all the benefits, but none of the downsides of JavaScript. Types is going to be the big pain point, as you will likely learn the hard way.

    Typescript doesn’t solve this except at the static level. When your application exchanges data with the external world, by which I mean anything external to the code you wrote, you’re at risk, as there is zero type-checking in function calls, in data exchanges via web requests, or anywhere else.

    The results range from, best case, your script crashes, which is often hard to debug, because the wrong type can travel through many function calls and Promises etc. before causing an error – to, worst case, your program executes, but does something entirely else than intended, making the problem not only difficult to debug, but difficult to detect in the first place.

    And maybe you think you’ll get around all that with tests, but reality is, nobody manually tests every internal function in a codebase. Are you going to cover every function with unit tests to see how it responds when you pass it every conceivable wrong type? Of course not, your test suite would end up being 90% noise. Are you going to add type-assertions to every argument in every function? Even if you do, authors of third party code you depend on did not.

    Even if you test everything like crazy, and fight like hell to keep unsafe code out of your dependencies (completely unrealistic), at some point, you would most likely have to concede why some of us insist either on static guarantees, which Typescript does not provide, or run-time guarantees, which JavaScript does not provide.

    PHP’s type system isn’t great, but at least it has type-checking in function calls. It now has type-checked properties as well.

    This simple fact keeps me firmly on the side of PHP, if the choice is between the two.

    For all the fun and cool stuff that JavaScript does, and for all the ugly in PHP, I’m not even tempted.

    But good luck with that. I hope you find what you’re looking for. But I’m pretty sure you’ll find something else as well.

  4. Thank you for your feedback, I just discovered Livewire. The thing about Laravel applications that are built for large-scale use is that you find out there still in one way or the other rely on JavaScript. My point is, why not just build an application with one language handling both the client and server-side?

  5. java script is not secure. Any one can see de code with little or no difficult. Use resources of the computer which PHP does not. 45% of web servers use php.

Leave a Reply