Please critique my PHP framework: CodeFrame

Coding Critique is the place to post source code for peer review by other members of DevNetwork. Any kind of code can be posted. Code posted does not have to be limited to PHP. All members are invited to contribute constructive criticism with the goal of improving the code. Posted code should include some background information about it and what areas you specifically would like help with.

Popular code excerpts may be moved to "Code Snippets" by the moderators.

Moderator: General Moderators

Post Reply
codeframe
Forum Newbie
Posts: 6
Joined: Wed Jun 17, 2009 2:59 am

Please critique my PHP framework: CodeFrame

Post by codeframe »

Hello,

I would like to know what people here think about a framework I wrote.

http://www.majgaj.com/codeframe

This project was born some time ago and now I got inspiration to continue on this. Please have a look at the project and tell me your thoughts on it.

Thanks!
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Please critique my PHP framework: CodeFrame

Post by onion2k »

The documentation isn't complete. How can anyone evaluate it?

Also...

Code: Select all

<?= $this->content ?>
Seriously?
codeframe
Forum Newbie
Posts: 6
Joined: Wed Jun 17, 2009 2:59 am

Re: Please critique my PHP framework: CodeFrame

Post by codeframe »

onion2k wrote:The documentation isn't complete. How can anyone evaluate it?
Evaluation can be done by downloading the source. As this is 0.xxx release I'm not putting effort into detailed documentation. And also by actually reading what is written in the documentation pages that are currently available. By looking at the access logs, you spent about 3 seconds per page.
onion2k wrote: Also...

Code: Select all

<?= $this->content ?>
Seriously?
And you are saying?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Please critique my PHP framework: CodeFrame

Post by onion2k »

codeframe wrote:
onion2k wrote: Also...

Code: Select all

<?= $this->content ?>
Seriously?
And you are saying?
Short tags and the shortcut "=" echo are both very bad practise in PHP development*. The php.ini short_open_tag directive needs to be switched on for them to work, which, in any properly configured environment, won't be the case. And finally, short tags won't be in PHP 6.

* Arguably Zend's push to use "PHP as a template" encourages them, as does CodeIgniter's template system, but both of those frameworks have a system to expand them out. Your framework doesn't (at least, not according to the documentation).
codeframe
Forum Newbie
Posts: 6
Joined: Wed Jun 17, 2009 2:59 am

Re: Please critique my PHP framework: CodeFrame

Post by codeframe »

Well, replacing <?= with <?php echo is not a tremendous amount of work done if it bother someone. Some like the short tags and some don't.

Its a matter of preference I think until we get to PHP 6.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Please critique my PHP framework: CodeFrame

Post by onion2k »

codeframe wrote:Its a matter of preference I think until we get to PHP 6.
Well, true, but if I were to run the default template you've included with your framework on my server here it'd fail (it'd output the raw PHP text). No problem for me because I've been writing PHP for over a decade but a new user wouldn't immediately understand what's wrong and would be confused by it.

If you're writing libraries and frameworks they need to work with the minimum of configuration especially for new users.
codeframe
Forum Newbie
Posts: 6
Joined: Wed Jun 17, 2009 2:59 am

Re: Please critique my PHP framework: CodeFrame

Post by codeframe »

Thanks for your reply. You are correct, the framework should work with minimal server configuration. I never thought about this as I have never stumbled upon a server in which the short tags are disabled, not even at my work.

I will make the changes in the next release.
codeframe
Forum Newbie
Posts: 6
Joined: Wed Jun 17, 2009 2:59 am

Re: Please critique my PHP framework: CodeFrame

Post by codeframe »

I created a Subversion repository in Google Codes, so that people can look at the source code before downloading.

http://code.google.com/p/codeframe/sour ... #svn/trunk
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Please critique my PHP framework: CodeFrame

Post by Benjamin »

codeframe wrote:Well, replacing <?= with <?php echo is not a tremendous amount of work done if it bother someone. Some like the short tags and some don't.

Its a matter of preference I think until we get to PHP 6.
Not so much. You'll get parse errors in XML files.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Please critique my PHP framework: CodeFrame

Post by onion2k »

astions wrote:
codeframe wrote:Well, replacing <?= with <?php echo is not a tremendous amount of work done if it bother someone. Some like the short tags and some don't.

Its a matter of preference I think until we get to PHP 6.
Not so much. You'll get parse errors in XML files.
That's not wrong, obviously, and I've seen it as an argument against short tags many times, but I've never quite worked out why you'd be putting PHP source code through an XML parser in the first place so it's a bit redundant really. Right?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Please critique my PHP framework: CodeFrame

Post by Christopher »

Seems like a fine super minimal framework. It's really more a simple Front Controller and a few utility classes.

As for <?= vs <?php echo, why ever use <?= when it is not supported everywhere, its is going away, and it provides minimal/no benefits. I don't even find it more readable because I am used to looking for <?php echo.
(#10850)
Post Reply