views:

74

answers:

1

I am a PHP developer, I read about J2EE technologies and I want to implement such technologies( n-tier, EJB, JPA...) with PHP and all what coming with ( MySQL, Apache..).

+2  A: 

Don't.

PHP is not Java. Writing PHP code like you'd write Java code is silly and counterproductive. It's very likely to make future maintainers of the code want to hurt you.

Need to persist an object? Use an ORM.

Need a multi-tier architecture? If you design your code with proper separation of concerns, you've already gotten 9/10ths of the way there.

EJBs? Every time I read the Wikipedia article, they're described differently. Reusable components? With a standardized interface for what, distributed applications and data persistence? Useful, yeah, but that's not PHP. ORMs and a a good message/work queue will get the job done.

The bottom line: For the vast majority of PHP scripts, you will not need any "enterprise technologies." If you do, you're doing something wrong: either you've having overarchitected the application, or you've chosen the wrong platform.

Start by picking a modern PHP framework, and build your application from there. If you're coming from Java, then Zend Framework will seem the least foreign. Kohana, Symfony and CodeIgniter are all worthwhile. Avoid Cake for now.

Keep it simple and you can't go wrong.

Charles
EJBs are related to an ORM, which Java terms JPA (Java Persistence Architecture).
R. Bemrose