Live data from Hacker News

PHP Apprentice – An online, open-source book for learning PHP

phpapprentice.com

31–40 of 75 posts

Re: PHP Apprentice – An online, open-source book for learning PHP

#31
post #3

Very well done, there’s a lot to help a novice PHP developer. I feel like the next chapters I’d love to see would take those concepts and apply them to building something. Everything so far unless I missed it is focused on the backend but it’s important to show that it’s also possible to use it as a front end and what the modern approaches to doing that are.

Thats a good point. PHP is a general language, but used almost exclusively for web development and most websites now use a framework (symfony/laravel......) etc.

I'm learning symfony framework after my micro framework of choice lost its support (Silex..).

The symfony documents are ok, but I wouldn't want to give them to someone starting out. (though looking again, they seem better..) https://symfony.com/doc/current/page_creation.html

Someone showed me the free video cast howto build a basic symfony site. I though it was pretty good. Like many of these, the basic tutorials are free, but its a subscription site.

https://symfonycasts.com/tracks/symfony

Re: PHP Apprentice – An online, open-source book for learning PHP

#32

I love PHP, it was my first “real” programming language, and I’m glad there are still people trying to make it easier to adopt. Having skimmed through several of these chapters, though, I just feel like it’s too similar to the official PHP docs, even down to the TOC. Wouldn’t it have been better for everyone to put this effort into improving the docs, rather than developing yet another book in a silo that likely won’…

I started with foundational concepts which will overlap some with the official docs. The advantage of my site is I wanted it to be more readable, since the official docs can be hard to navigate. In the future, I want to cover topics like Composer and Slim which would not be appropriate for PHP.net.

That’s cool and does give the comprehensive approach some credence, but still feels like duplicated effort and the potential for outdated content (on both sides).

FWIW, I don’t think giving a more readable aspect to the official docs would be bad. It’s already got way more of that feel than it did in PHP 4, when it had more of an MSDN auto-generated parameter documentation feel. With the clear sections and code snippets I think both could be achieved with little extra effort.

Re: PHP Apprentice – An online, open-source book for learning PHP

#33
post #19

Nice little reference for anyone who already knows how to program, but might not know PHP. For anyone else, this isn't really going to help. There seems to be no explanation of _why_ you would want to do anything here or even how it relates to a goal. Who is your audience?

IMHO, I think the audience is me. I can program (perl, java, c++). I know that php is easy but that there are many traps. I need a book to be able to develop quickly with sane practices. The official documentation contains too much old crust.

Re: PHP Apprentice – An online, open-source book for learning PHP

#34
post #4

Nice job and well written. A nice addition would be how to use pdo. I'm appalled by the number of ressources I see online which are using the old mysql api.

https://phpdelusions.net/pdo has done a very thorough job of covering PDO IMO and makes a fantastic companion to https://phptherightway.com/.

Re: PHP Apprentice – An online, open-source book for learning PHP

#35
post #33
post #19

Nice little reference for anyone who already knows how to program, but might not know PHP. For anyone else, this isn't really going to help. There seems to be no explanation of _why_ you would want to do anything here or even how it relates to a goal. Who is your audience?

IMHO, I think the audience is me. I can program (perl, java, c++). I know that php is easy but that there are many traps. I need a book to be able to develop quickly with sane practices. The official documentation contains too much old crust.

Too much old crust, but as other commenters around indicate, this isn't really solving that either: it doesn't talk about best practices or even highlight where the sharp edges are (EOLs and Namespaces are mentioned elsewhere).

Re: PHP Apprentice – An online, open-source book for learning PHP

#36
post #8

Earlier quoted context omitted.

> I'm appalled by the number of ressources I see online which are using the old mysql api Recently authored articles? We have an internet filled with 20 years of PHP tutorials, and unfortunately for beginners there's not an easy way to evaluate if something utilizes modern best practices or is an Experts Exchange post from 2001.

I find strange you can't down-vote a link on Google, it should exist and Google should take it into account specially for technical links (less so for opinions articles or anything political)

Everything is political. I wouldn't want people to downvote Mercurial links into oblivion.

Anyway, Google links are pretty much already ordered by popularity.

Re: PHP Apprentice – An online, open-source book for learning PHP

#37
The null coalescing operator ?? is not well explained. It returns the first operand but if it's not set or null, will return the second operand, i.e:

    $name = $_GET['name'] ?? $_POST['name'] ?? "unknown";
In the arrays section, I'd also introduce the $array[] shorthand for array_push(), i.e:

    $array[] = $new_element;

Re: PHP Apprentice – An online, open-source book for learning PHP

#38
post #33
post #19

Nice little reference for anyone who already knows how to program, but might not know PHP. For anyone else, this isn't really going to help. There seems to be no explanation of _why_ you would want to do anything here or even how it relates to a goal. Who is your audience?

IMHO, I think the audience is me. I can program (perl, java, c++). I know that php is easy but that there are many traps. I need a book to be able to develop quickly with sane practices. The official documentation contains too much old crust.

This was my same takeaway thumbing through. I think I'll take the weekend to grok PHP a bit better.

Thanks for publishing this op!

Re: PHP Apprentice – An online, open-source book for learning PHP

#39
Thanks for reading! This is still a young project with room for improvement and new sections. I’m already planning some content for building web pages, database access and package management with Composer. I wrote an announcement post over on dev.to if you want to read more about how the site was built: https://dev.to/restoreddev/announcing-php-apprentice-coc

Re: PHP Apprentice – An online, open-source book for learning PHP

#40
post #36

Earlier quoted context omitted.

I find strange you can't down-vote a link on Google, it should exist and Google should take it into account specially for technical links (less so for opinions articles or anything political)

Everything is political. I wouldn't want people to downvote Mercurial links into oblivion. Anyway, Google links are pretty much already ordered by popularity.

That's the problem, in technical links popularity (as in number of visits) is not linked to correctness, that's one of the reasons StackOverflow is so useful, because the top-voted answer is like 99% of the times the most correct (useful) one.
Post reply on HN