Page 1 of 2
PHPx framework
Posted: Tue Mar 10, 2009 11:30 am
by crazycoders
I have started building a framework for php. (Not another one you say, we have enough thank you)
I have yet to see something like mine. It is based on ASPX (or ASP.Net) but it's not focused around the .Net framework but more on the postback handling idea that ASP.Net uses. It is extremely simple to use compared to those other frameworks out there. I'd like your input on the first post about it on my blog, thanks.
http://www.allianceunisport.com/index.p ... ework.html
Re: PHPx framework
Posted: Thu Mar 12, 2009 9:33 am
by crazycoders
I see several people looked at the post but i got no comment at all, anyone care to actyally comment the strategy i'm exposing for my framework? Anyone interrested in knowing more?
Re: PHPx framework
Posted: Thu Mar 12, 2009 11:41 am
by Christopher
Can the framework with examples be downloaded? What is the license?
Re: PHPx framework
Posted: Thu Mar 12, 2009 12:50 pm
by crazycoders
No not yet since it's not complete at all, but what you see on my blog can give you a good example of what is available:
Features:
Postback handling
Viewstate
Object oriented programming with event handlers
Component based programming
Declarative syntax and codebehind file
Components current developped:
system_forms_web_label (50%, styles left to be implemented)
system_forms_web_button (50%, styles left to be implemented)
system_forms_web_fontstyle (99%, finishing touches)
Ajax
Will not support ajax for now but already designed to support strong postback and change handling via ajax
Re: PHPx framework
Posted: Thu Mar 12, 2009 12:52 pm
by crazycoders
Example of a declarative syntax page (index.phpx)
Code: Select all
<phpx>
<library namespace="system.forms.web.buttons" library="xstdb" />
<library namespace="system.forms.web.debuggers" library="xdgb" />
<library namespace="system.forms.web.labels" library="xstdl" />
<library namespace="system.forms.web.styles" library="xcss" />
<page codebehindfile="index.php" codebehindclass="indexpage">
<fontstyle id="pagefont" rule="body" fontfamily="Arial, Helvetica, sans-serif" fontsize="12px" fontstyle="inherit" />
<div style="padding-left: 10px" class="pagefont">
<label library="xstdl" id="message" text="Nothing to say" blocktype="inline" />
<button library="xstdb" id="sayhello" text="Say hello" onclick="mypage.sayhello_click" /><br />
<button library="xstdb" text="Postback with no changes" /><br />
<button library="xstdb" id="restoremessage" text="Reset message" /><br />
<button library="xstdb" id="changesizebig" text="Change font to bigger font" /><br />
<button library="xstdb" id="changesizesmall" text="Smaller font" /><br />
<button library="xstdb" id="swapbold" text="Swap bold state" /><br />
<button library="xstdb" id="swapitalic" text="Swap italic state" />
</div>
<inlinedebugger />
</page>
</phpx>
Re: PHPx framework
Posted: Thu Mar 12, 2009 12:52 pm
by crazycoders
Example of a codebehind file
Code: Select all
<?php
class indexpage extends system_forms_web_page {
//Constructor of the page object
public function __construct(system_framework $framework){
parent::__construct($framework);
}
//Initialize of page
public function initialize(SimpleXMLElement $content){
parent::initialize($content);
//Bind the button event
$this->sayhello->addHandler('onClick', $this, 'sayhello_click');
$this->restoremessage->addHandler('onClick', $this, 'restoremessage_click');
$this->changesizebig->addHandler('onClick', $this, 'biggertextsize');
$this->changesizesmall->addHandler('onClick', $this, 'smallertextsize');
$this->swapbold->addHandler('onClick', $this, 'setbold');
$this->swapitalic->addHandler('onClick', $this, 'setitalic');
}
//Button handlers
protected function sayhello_click(system_forms_web_button $sender, array $args){
$this->message->text = 'Hello';
$this->message->blocktype = LABEL_BLOCKTYPE_BLOCK;
}
protected function restoremessage_click(system_forms_web_button $sender, array $args){
$this->message->text = 'Nothing to say';
$this->sayhello->text = 'Reset to "hello"';
$this->message->blocktype = LABEL_BLOCKTYPE_INLINE;
}
protected function biggertextsize(system_forms_web_button $sender, array $args){
$this->pagefont->fontsize->size *= 1.5;
}
protected function smallertextsize(system_forms_web_button $sender, array $args){
$this->pagefont->fontsize->size /= 1.5;
}
protected function setbold(system_forms_web_button $sender, array $args){
if($this->pagefont->fontweight == 'bold'){ $this->pagefont->fontweight = ''; }
else{ $this->pagefont->fontweight = 'bold'; }
}
protected function setitalic(system_forms_web_button $sender, array $args){
if($this->pagefont->fontstyle == 'italic'){ $this->pagefont->fontstyle = ''; }
else{ $this->pagefont->fontstyle = 'italic'; }
}
}
?>
Re: PHPx framework
Posted: Thu Mar 12, 2009 1:18 pm
by crazycoders
Forgot to say that there is also an inlinedebugger component that is 50% complete, styling is left to accomplish
Re: PHPx framework
Posted: Thu Mar 12, 2009 2:23 pm
by crazycoders
I have trouble finding out which nodes have text data in them using simple xml, so i have to rewrite everything so far to use domxml... yay!
Re: PHPx framework
Posted: Thu Mar 12, 2009 3:54 pm
by crazycoders
Allright fixed, so if interrested in knowing more arboprint (or anyone else) just ask away
Re: PHPx framework
Posted: Thu Mar 12, 2009 5:42 pm
by Christopher
Well to be honest I am not that interested in yet-another-framework, especially one based on ASP.net. And you haven't said whether you are going to release the code or what the license is. I am also of the opinion that a solo coder cannot produce a framework that more than about three people would like enough to actually use.
Man ... do I always sound like such a downer and hater??
That said, certainly discussing frameworks can be interesting and informative. When you have something that people can download and try I think you may get some feedback.
Re: PHPx framework
Posted: Thu Mar 12, 2009 6:37 pm
by crazycoders
K thanks, i was more looking into a development discussion than a test, but it's ok.
For the licensing, i don't know what are the different licensing options. I guess if you can tell me which one copes best with my description then it will be it:
- Free for use and distribution as part of a software suite or web application
- Cannot distribute anywhere else than on mirrors or official site
- Change at your own risk
- Do not incorporate as part of your own framework, help me develop this one instead
- Do not remove author, add your author info if you change stuff
- Send in changes if you do changes, (to see if that change can be made part of base product)
- No responsibility can be taken from author or if user changes code
Am i missing something, does it fit in with a known license you know (i guess you are talking about those GPL or GNU things we see from time to time right?)
Re: PHPx framework
Posted: Thu Mar 12, 2009 7:10 pm
by crazycoders
In regards to
I am also of the opinion that a solo coder cannot produce a framework that more than about three people would like enough to actually use.
I wonder why? Because you know that no one can actually produce such a framework that would achieve your highest standards? Or simply because you are not a framework type guy? Or maybe because its based on M$?
That said, who said i was solo? I'm open to propositions!
Re: PHPx framework
Posted: Fri Mar 13, 2009 2:55 am
by Christopher
Creating a design that you are happy with is pretty easy. To make a second designer happy is difficult. Keep adding designers and experience the unhappiness asymptote.

Re: PHPx framework
Posted: Fri Mar 13, 2009 3:24 am
by Benjamin
@arborint, you are seriously full of all sorts of wisdom. That's awesome. And no, I'm not being sarcastic. How long have you been in this field?
Re: PHPx framework
Posted: Fri Mar 13, 2009 8:17 am
by crazycoders
To respond to the licensing, i read a little bit about it. I will probably release it under GPLv3 to make it copyleft and prevent forks. I prefer people help me develop a strong framework than starting to copy and derive from my work. Second reason is that if they go and change the way it works, they may change the philosophy behind it and fork to a completly different system whilst not having to code the core of it...
Am i right to choose this? If i'm not wrong it responds to my previous needs:
(Green = yes, Orange = not sure, Red = doesn't)
- Free for use and distribution as part of a software suite or web application
- Cannot distribute anywhere else than on mirrors or official site
- Change at your own risk
- Do not incorporate as part of your own framework, help me develop this one instead
- Do not remove author, add your author info if you change stuff
- Send in changes if you do changes, (to see if that change can be made part of base product)
- No responsibility can be taken from author or if user changes code