Top products from r/PHPhelp

We found 19 product mentions on r/PHPhelp. We ranked the 16 resulting products by number of redditors who mentioned them. Here are the top 20.

Next page

Top comments that mention products on r/PHPhelp:

u/greg8872 · 1 pointr/PHPhelp

Slow, and had required reworking things a few times as I get used to things. I am liking the final outcome of it though. The framework i had built out over the years was pretty structured, and did a good job of keeping logic and presentation separate, so was quite clean and easy to follow.

I know I'll have several revisions on things as time goes on and can better see how to work things. I have always been one to learn best actually creating something and seeing how it works vs. just reading. That being said, this book was awesome for me.

The big stuggle I'm still having is accessing different objects from in other objects. ie, create a database object, then had to pass that into template class, then from in there having to pass it into an "outside" callback function.. I'm looking into changing it to using a static method (think that is right term) to return an instance of the database class where needed, so can just do $db = ProjectName\DB::getInstance(); instead of passing $db around all over.

Also while I understand it, using the name spaces gets "long worded" for using things like constants...

$obj = new ProjectName\clasname();

$obj->doSomething( $args, ProjectName\classname::CONSTANT_NAME )

At least a good IDE with code insight helps a ton!

u/mogwai512 · 3 pointsr/PHPhelp

> I want to return response in real time to javascript

I'm about to get really thorough with my response so, "hold on to your butts"


As /u/Mike312 hinted at, this is not how PHP and vanilla Javascript works, and as such you would have to seek alternative frameworks or languages(like Websockets, NodeJS) or you can keep reading for an alternate solution.

What you must understand is that PHP is code that lives on and is rendered on the back-end (server). That means that by the time the front-end (browser) has access to the page, the PHP code on the server has already executed.


Now that you better understand relationship between PHP & Javascript means you have two options, a simple one and a more complex one:


Simple Option: Abandon real-time

Since you seem to be a beginner when it comes to PHP, this is the option I recommend as it is the simplest and fastest. In this case, you would have something on the front-end, like a button, that would call a new page. This page will render the results of the function I provided you.

To break it down:

  1. You press a button in the browser.
  2. The button redirects you to a new page.
  3. The new page has the PHP function I provided you above, and runs it.
  4. A page is the rendered to the user saying something like "After X attempts, here are the results: "


    Complex Option: Explore AJAX

    AJAX or Asynchronous JavaScript and XML allows your browser(front-end) to make calls to your server (back-end) without reloading the page. This means that, as an example, you can create a button on the front-end that executes a javascript function. The javascript function would then make an AJAX call to your server, and you could return that server data WITHOUT having to reload your page. Please see the link I provided above for a very good example.

    I won't write up full on code for you that shows you how the HTML/JS/AJAX/PHP all interact but, here is an outline of how I would do it:

  5. Modify the fgcContents function I gave you above to only take in a URL, and only return results and data. Since you are using AJAX, your front-end should manage and return the number of attempts. This will be explained in more depth later

  6. Create an HTML page with a button.

  7. Have the button trigger a Javascript function

  8. Have the JS function define two variables, the number of attempts and the URL to hit (the url is where your PHP code will reside).

  9. With those variables defined, build out your AJAX request using the url variable, but do NOT call it yet. Instead, define a loop that will repeat X times, with X representing the variable you defined above as the "number of attempts".

  10. Inside the loop, make the AJAX call, but also add checks for whether or not the AJAX call failed or succeeded.

  • If the AJAX call succeeded: This means that the AJAX call was successful, it does NOT mean that your fgcContents function was successful, so you need to examine the results of the call (which should be the results of the "fgcContents" function) and use javascript to update your HMTL. For example, if "fgcContents" returns an array where "results" is TRUE, then you can update or add some HTML on your page that says "Attempts: 1 and Data: your_data_here". If results is "false" ("fgcContents" returns an array where "results" is FALSE), then you can update your HTML to list out the number of failed attempts, and with each failed attempt, the users page will update, thus providing you real-time results.

  • If the AJAX call failed: Again, this does NOT mean the fgcContents function failed, it just means the AJAX call did not go through. This can happen due to errors in your code, network issues, etc. Either way you will need to capture this and report it to the user somehow.


    I know this is a lot of info to take in, but it should help implement a simple solution, then as your knowledge grows you can implement the complex solution.

    As a side note, if you are really looking into learning front-end/back-end development, I recommend the following books:

    Web Design with HTML, CSS, JavaScript and jQuery Set

    PHP & MySQL Development
u/starrylovesfedoras · 1 pointr/PHPhelp

They're outdated now but I used:

3rd Edition of The Object Oriented Thought Process

[PHP Object-Oriented Solutions] (

[4th Edition of PHP Objects, Patterns, and Practice] (

Searching for this stuff on Amazon, I saw that The Object Oriented Thought Process is coming out with a new edition near the end of November. You might want to grab a pre-order of that. That's the OO book I started with.

The second book was a gentle introduction into understanding OO specifically in the context of PHP, but it's 10 years out of date, so I don't recommend it. If I was doing this learning now I'd look for something released in the PHP 7 era.

The third book had an edition come out in 2016, so it seems current enough but you might find it really advanced for you. I read it after I was done with the first two books, so my mind was prepared to understand.

So, for now. I guess try the 5th edition of The Object Oriented Thought Process and then after that try to find something current (PHP 7 era) that covers OO in PHP specifically.

u/joellarson · 1 pointr/PHPhelp

If you want to understand why objects and interfaces are useful, I'd recommend reading Head First Design Patterns. It is truly the first resource I came across that made me grasp why objects and interfaces have a useful purpose.

I started to write an example for ELI5, but I decided that the first two chapters of that book would be a great example. It even includes ducks. :P

u/topfpflanze · 2 pointsr/PHPhelp

Coding Style:

Currently there is a lot of discussion about the PSR-1 and PSR-2 standards. The PSR-0 is definitly something which you should know about and follow it.

OOP structuring, Design Patterns:
Understand design-patterns (the standard book on this topic by the gang of four), and have a look into the topics of MVC and dependency injection. Zend Framework 2 and Symfony2 are the two major frameworks in this context.

Maybe also learn to know how database patterns like ORM and/or Active Record work. (Frameworks like Doctrine2, Zend_Db,...)

Test Driven Devlopment:
Check out PHPUnit and Behat for Behaviour Driven Testing

Version Control:
Our teams (2-8 programmers) work with both Subversion and Git. I recommend to check out both. Each has its disadvantages and advantages. There is a lot of discussion out there.

Related to this is the knowledge of Continous Integration and the connected tools. (Keywords: Jenkins, Bamboo, phpUnderControl, Hudson)

u/modestview · 2 pointsr/PHPhelp

I had the same feeling a few months ago, so I bought Modern PHP. It's done a pretty good job of catching me up.

u/am0x · 1 pointr/PHPhelp

This is a really good book as well. Very in depth about OOP and you will learn a whole lot:
PHP Objects, Patterns, and Practice

u/DinnerMilk · 1 pointr/PHPhelp

One ASIN that is acting up is B00QQ5Q3BI. When I google it and use the Amazon link, it takes me to B079DLFWRS, so I am not sure if they changed it or why it now links to 2 different ones, but that is a good example of a problematic one because they are both causing the issues I described.

u/doodooz7 · 2 pointsr/PHPhelp

Start with this one: Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning PHP, MYSQL, Javascript, CSS & HTML5)

u/phpworm · 1 pointr/PHPhelp

The 5th edition is the most recent, I believe, which covers up to PHP 7.