Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Examples of good PHP code (entire projects) where can I find them?
9 points by omilu on Nov 7, 2014 | hide | past | favorite | 15 comments
It's easy to find great examples of C (Redis, Git), but not easy to find good PHP. Anyone know where to look to find good PHP code worthy of study?


There are several Frameworks that feature the most well written code out there.

Symfony is one of them and has some of the best PHP code out there:

https://github.com/symfony/symfony/

As well as Aura: https://github.com/auraphp

And Laravel: https://github.com/laravel/laravel


I find it a bit funny that all the recommendations here are of php frameworks and none that are projects built in php outside of that


Why? Any 'good' web project in any other language also involves a framework, does it not? Ruby has Rails, Python has Django, etc.

It should be no surprise that structured and organized PHP is better than raw PHP, and that examples of well written PHP would probably involve a framework.

Although I suppose it could be argued that since PHP is intended for the web, it shouldn't need a framework, and it should support more of the features a framework provides out of the box than it does. Nevertheless, the pattern of a framework is as useful in PHP for the same reasons as it is elsewhere, so I don't believe it says anything negative about the language per se.


You're missing my point. I'm not the Op but had I been the one asking the question, I would love to see actual projects that have clean php code written (even if they were using a framework), rather than refer to how a framework itself is written.


May start here: https://github.com/search?l=PHP&o=desc&q=php&s=stars&type=Re... and see what you find.

Particularly, the newer PHP frameworks, Guzzle, Composer, and PHPUnit are good to look at.


You can look at the source of the symfony httpfoundation bundle, it is the best php code in my opinion.


Laravel is very well written and has some really cool stuff going on, particularily the IOC container. https://github.com/laravel/laravel


Have heard great things about CodeIgniter's source: https://github.com/bcit-ci/CodeIgniter


Within the last year, I think, somebody posted a link on HN to early Facebook code. I hardly glanced at it, but I remember that it looked well-structured and perhaps well-commented.


Try checking these out:

http://thephpleague.com/

They are very high-quality libraries.



Checkout Zend Framework 2 source code.


wordpress.org


No such thing. Use a real language.


/dev/null




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: