collegeman / php-tent-client

A library for connecting to Tent servers, and a Console app for browsing server content
10 stars 0 forks source link

PSR-0 and composer.json #2

Open beberlei opened 11 years ago

beberlei commented 11 years ago

Please make your classes follow PSR-0 and add another vendor-namespace, like

lib/TentPHP/Application.php (TentPHP_Application or TentPHP\Application)

See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md

Also a composer.json file to make this library distributable through composer and packagist.org. Composer is a new package management tool that already allows to install over 2000 PHP packages and is used by many major libraries such as Drupal, Symfony2, Zend Framework2.

http://getcomposer.org/ http://www.packagist.org

If you want i could contribute both changes, i really want to see a high quality tent php library early on and this one here is much better than the other one I found.

collegeman commented 11 years ago

Hi beberlei! Thanks for the suggestions. I'll leave this issue open until I've had time to consider this completely.

collegeman commented 11 years ago

OK, so maybe you can help me navigate this. I understand the standard (PSR-0), and I understand why it's important to the community. Here's my problem. I'm making this effort primarily so that I can utilize my client and server implementations within the WordPress community. WordPress still supports 5.2 (specifically 5.2.4 and up), so I can't use PHP namespaces, which means that I have only the class name with which to create an isolated namespace.

Is there any way that I can embrace PSR-0 without utilizing 5.3 namespaces?

beberlei commented 11 years ago

@collegeman Yes, PSR-0 falls back to the "old" way defining class to directory mappings by using the underscore, so you could do "TestPHP_Application" for example for a file in lib/TentPHP/Application.php

collegeman commented 11 years ago

PSR-0 support implemented. Will add composer.json in the near future. Thanks!