PHP and Javascript

Dear Mr. Butler,

what are the sugested material to study PHP and VUE. Each time I started to try study Vue.js and others (Node, Angular, Deno) it was too overwhelming to prepare my PC for devel (except DENO). After reading the concepts of MVC on https://r.je/ in past it seems to be total mess which must be avoided and as a non-pro programmer I can not handle in the future ;-) But on the other hand some "almost real time" features would be great. Example based on this book. all connected users to IJDB could be informed immediately when joke is updated, inserted, chat to each other.... Anyway Mr. Butler thank you for your work, it is a great inspiration source for me and your work is the main reason I have prepaid sitepoint premium. Best regards from Prague. Jan


Link to content: PHP & MySQL: Novice to Ninja, 7th Edition - Section 2

1 Like

Stick with one language at a time and don’t be distracted. JavaScript is arguably one of the most important languages to learn to become a professional web experience creator. However, if you want to learn php stick with that. There are plenty of corporations that still need php work horses to maintain their older projects and/or CMSs. ie. WordPress, Drupal, Magento, etc.

Rather strongly disagree.

They are different tools for different parts of the web experience.

Javascript is a tool on the front end, to handle interactivity with the user directly.
HTML is the basis of all web sites; without that language Javascript has nothing to play with.
CSS is a language and discipline unto itself at this point, and provides the styling that shapes the user’s experience.
All three of these are your frontend components/languages. But for anything using a server, you will need some form of backend language. PHP is one such language.

I strongly, strongly disagree with the notion of ignoring all else for Javascript. Learn a well rounded language set and you’ll be able to do a lot more well, than one particular thing excellently. Have a specialization, but not at the cost of general competancy.

I never said to ignore html and css.

This is disinformation.Accessible SEO compliant SPRs can be created with JavaScript and HTML alone. You don’t need PHP, Java, .NET or any server really to build highly performant dynamic websites now. Furthermore you don’t even need servers anymore either with CDNs and serverless technologies.

Server-side rendering refers to an application’s ability to display the web-page on the server rather than rendering it in the browser. When a website’s JavaScript is rendered on the website’s server, a fully rendered page is sent to the client and the client’s JavaScript bundle engages and enables the Single Page Application framework to operate.

Serverless Pre-Rendering (SPR) is a suitable technique for anytime you want to serve fast pages, from anywhere in the world, that are produced by dynamic datasources and computation .

Serverless computing is a cloud computing execution model in which the cloud provider allocates machine resources on demand, taking care of the servers on behalf of their customers. “Serverless” is a misnomer in the sense that servers are still used by cloud service providers to execute code for developers.

None the less SPRs and Serveless computing are rather advanced topics not suitable for someone just starting out. However, the predominant languages that are used in those stacks can be very relevant to put people on the proper career path. If php is your thing though go for it.

Create for me a database that can be accessed purely from Javascript without exposing the username and password and shared between users while holding secure information.

PHP isnt just about making something Dynamic. It’s “disinformation” to say it is. The world is not just

I would question what you consider “new” and/or “not a CMS”. Is Facebook (PHP)? Twitter (C++/Java)? Instagram (Python)? Wikipedia (PHP)?

Don’t be so quick to dismiss backend coding.

#1: You have assumed the OP’s career path.
#2: You’ve not addressed the idea that PHP isnt one of those languages.
#3: This question is being asked in relation to a PHP book… so probably, the user wants to use PHP. Just a thought.

Dear all,
Thank you all for your time answering my unclear question. I do apologize. It was my first try to do so using the UI within a website book on Sitepoint. I expected that the answer will contain a paragraph that I selected to Ask Question. :wink:

JavaScript and Interactivity

As the Web has evolved, so too have the options for communication between the front and back ends of a web app. JavaScript allows for communication with a back end without page reloading. A JavaScript framework such as Vue.js, for example, can communicate with PHP frameworks like Laravel. For the purposes of this book, however, we’ll focus on what can be done with PHP alone.”

So my question was related to this paragraph. I hope that this can help better understand to answer my question.

@m_hutley

You are right that you need some kind of backend but you are wrong when you advise PHP for it.

I used PHP for backend many years, but this times are over. Nowadays backends are written in more modern languages and frameworks like .net (I hate it) spring boot (Godzilla is back) or node.js (my favorite)

Btw it’s a big advantage that you can create front and backend with JavaScript as you no longer need to learn multiple languages.

1 Like

Again… this thread is from a PHP book.
I dont think its “wrong” to say that PHP is a viable backend. I also dont think its the only backend.

1 Like

As far as resources on Vue, i’m afraid I dont have a good recommendation, but it should be noted that you dont need a frontend framework to interact with PHP (or for that matter, any backend) asynchronously - any AJAX call, which can be made in vanilla Javascript, can interact with any backend without reloading the page.

Tom seems to prefer (or at least imply a preference by inclusion) to Vue and Laravel. Personally, i’d say stick to the basic vanilla Javascript until you can feel out what best suits your development environment (either career or project). Others, clearly, have aversions to some backends over others.

Dear Thallius,

Thank you for your opinion. What THE best book/source would you suggest to study Node.js? Btw have you seen DENO? What is your main reason not to use php, what made you switch ;-)?

I love the way Mr. Butler is thinking and solving things. His Transphporm, Dice and Maphper are really great piece of thinking from my point of view. …and when you come to see something like Node.js, Vue.js it is like a big mess for the first time, even second time for me… Sorry for saying that.

But I am ready to learn new things!

Have a nice day

Dear m_hutley,
Thank You for your reply. I think, I understand what you are saying. I am leaving my question unanswered yet.
My goal was to work with something that I “know” a little (php), improve it. Changing the view (the part of MVC) to something new(Vue.js, whatever to move on) and transforming step by step to totally new :wink: But preparing the devel environment, setting the VSCode and “tons” of dependencies, different folders structure, versions, keep everything organized and in sync in time. It’s really crazy.

People have been saying this for decades, yet PHP is still around and actually has a market share of more than 75%.

Also, I don’t know when you stopped with PHP, but PHP 8.1 is a completely different beast than 5.6 or even 7.0. Combined with tools like PHPStan I still think its a language worth considering. It’s not the be-all end-all for backend, but no language is.

As with most things in IT, it depends.

This statistic is the worst you can find because they count the servers PHP is running on and of course the majority of web servers contain simple Joomla or Worpress sites which are written in PHP and the site admins will never change to another framework because it’s nearly impossible without writing everything new. But this servers are running for decades.