DEV Community

loading...
Cover image for Announcing PHP Apprentice!

Announcing PHP Apprentice!

restoreddev profile image Andrew Davis ・2 min read

I am excited to finally announce PHP Apprentice! It is an online, free and open-source book for learning the PHP programming language. The book is a side project I have been building for six months. My goal is to provide a contemporary resource for learning the basics of PHP with a focus on high quality code. PHP has been around for 25 years and has changed a lot since its inception. A lot of the resources for writing good PHP have not aged well or are inapplicable today. I wrote PHP Apprentice to remedy the lack of available websites for learning PHP.

Currently, PHP Apprentice has chapters on the basic building blocks of the language, but in the future I will be adding sections on generating webpages, connecting to databases and advanced techniques like using Composer and autoloading. I am looking for feedback so please leave a comment here or an issue on the repository if you have any thoughts or requests.

Each chapter in PHP Apprentice was written as a Markdown file. I then built an HTML generator in PHP that takes each file and parses it with Parsedown into an HTML chunk and loads them with a template into a full HTML page. The pages are then served by GitHub pages. The build process can be performed using a CLI command so I automated the deployment using Travis CI. Whenever any code is merged into master, Travis will pick it up, re-build all the webpages and push them to another branch on the repository which is used by GitHub Pages.

The frontend is all plain HTML, CSS and JavaScript. I used PostCSS to add file imports and variables. The code highlighting is performed by Prism.js. I wanted the focus of each page to be on the code so the styling is very minimal. The site is responsive, but has room to improve the experience on mobile. I focused on desktop since I recommend writing the code in the chapters while reading the book.

PHP Apprentice was inspired by Elixir School and Go by Example, two sites I admire for their clarity and quality. I hope that PHP Apprentice will become a similarly helpful site for the PHP ecosystem. It is a living book so I will be changing and improving the site over time.

Please check out PHP Apprentice and let me know what you think!

Discussion

pic
Editor guide
Collapse
martyhimmel profile image
Martin Himmel

Great job Andrew! Nice, simple layout with concise chapters and good examples. It's good to see new PHP resources these days, especially considering the vocal minority that attack PHP (usually based on old info/versions). πŸ™‚

Collapse
restoreddev profile image
Andrew Davis Author

Thank you! I do enjoy resisting the unwarranted PHP hate.

Collapse
5422m4n profile image
Sven Assmann

Great Job Andrew!
I have 2 suggestions:

I would recommend to dive into the array logic a bit more deeper, things like array_merge, array_filter or array_intersect are super handy tools yet not many folks have mastered the details about them. (from my experience)

On the other hand traits used for mixin / behaviours extension of classes are also a very valuable tool. It might be also worth to spread the word about these things.

But I guess the content will grow over time anyways. Keep up the good work!

Cheers
Sven

Collapse
david_j_eddy profile image
David J Eddy

Thank you for this Andrew. Your observation is very much on point; with PHP having been around for so long much of the documentation is way out of date.

I am loving the simple design and that you explained the deployment automation here a bit. Always neat to see how all the parts fit together. Are you planning to do an article centering on the automation?

I look forward to reading over your book Andrew, always good stuff from you. Keep it up!

Collapse
restoreddev profile image
Andrew Davis Author

Thanks for the kind words! There is a lot I would like to do with the book. I do have some thoughts about Travis so that’s a good idea to write a post about how it works.

Collapse
damirtomic profile image
DamirTomic

You need to specify the version your tutorials are written for. In 5 years, there's gonna be PHP 10 with a completely new feature set and different syntax. And your tutorial will be outdated as all the others are. Because the writer didn't specify the PHP version he or she worked in.

Some guy is gonna try to run your code ih PHP10 and it's not gonna work and he's gonna be super confused, just like I am when I try some PHP3 code on PHP7 :D

Other than that, the tutorial seems good, although a bit basic.

Collapse
bauripalash profile image
Palash Bauri πŸ‘»

Well, That's Cool! I really liked the interface.❀

I just took a glimpse of first few chapters, this is well written and easy to understand.

I hope you'll a PDF version so we can read it while offline πŸ™‚

Collapse
vonbusing profile image
Miro von Busing

Thanks Andrew that looks really nice. I am reading this with pleasure. A small comment about the Loop chapter: you use different kind of incremental operators without having introduced them. Something for the arithmetics section?

Collapse
codemouse92 profile image
Jason C. McDonald

Good, I've been meaning to learn PHP! (Although I think I'll wait until I'm done with my current three online courses and three books, yeah?)

Collapse
orbam7819 profile image
Ambrogio Piredda

I think it's great for an absolute beginner. Maybe you can add some simple exercises based on real world projects. And after that a little explanation on how to use the php manual for all the rest.

Collapse
felipperegazio profile image
Felippe Regazio

Great Andrew. Clean, direct and without distractions <3

Collapse
isaactorresmichel profile image
Isaac Torres Michel

Thank you for your work Andrew. I'll use it on my PHP workshops as an example of a nice PHP project and a good source of documentation.

Collapse
juanfrank77 profile image
Juan F Gonzalez

Hey, this looks neat! especially since in my job, I'm having to deal with some stuff of PHP for a legacy project. I'll definitely need a refresher.

Collapse
misteryomi profile image
Collapse
link2twenty profile image
Andrew Bone

I haven't used PHP properly in a few years so thought I ought to find some learning resources. This is exactly what I was looking for!

Thank you

Collapse
roynes profile image
Saitama

Thank you for this one!

also, for additional resources, you can go to laracast. and choose PHP bootcamp. Laracast has a lot of php, and for laravel also.

Collapse
aris profile image
Aris Ripandi

Pretty cool. What if this site available in other languages?

Collapse
vjnvisakh profile image
Visakh Vijayan

Really nice. Can't wait for more chapters.