PHP Framework
I'm starting a PHP Framework, named after myself. I need some ideas of what all to put on it.
At current, it's minimal, and I'm just setting up the foundation of the framework class itself (not its extensions), but works like this:
include('framework.php');
$fw->load('colors');
$hsl = $fw->colors->rgb2hsl(255, 128, 64); // converts red/green/blue to hue/saturation/lightness
$hsl[2] /= 2; // 0 = hue, 1 = saturation, 2 = lightness; makes the color twice as dark
print_r(hsl2rgb($hsl)); // outputs the darkened RGB value
So, it's mostly going to be:
$fw->load('some_name');
$fw->some_name->functions_of_that_extension();
What extensions should I offer?
As is, I got colors (albeit limited in function ATM; only added the above functions and complementary color calculator and split complementary color calculator), and that's it, since I just started yesterday. Thinking about adding MySQL and a Twitter API, but short on ideas after that.[/2]
What is this framework intended for?
Quick website building.
Using pre-coded extensions. Instead of programming from start of the GD library, you can just
$fw->load('images');
$fw->images->gradient($width, $height, $start, $finish);
And be done.
Which is what most frameworks are for, aren't they? Improved development time.
Hmm. I'm definitely going to be doing a lot of GD library stuff, like gradient generators, as I've started working on that a lot recently. I'll look into HTML generators.
You could also create a Javascript framework for stuff you can't do with PHP.
If I did, I doubt it could compete with jQuery. I'm good with JavaScript, but not nearly as good at the things that require timeouts - like animated expand/collapse, floating menus, and the like. i.e. the things that most people are looking for when using JavaScript frameworks. I'm just good enough to do what I need done at the moment.
My forte seems to be PHP. I love the bugger.
Definately add a mysql class. You want to build in a template framework as well - from my experience, extremely important when developing large websites. Maybe a class that formats/parses text? i.e some features could be.
Smilies -> images.
BBCode -> formatted html.
etc.
I finished the gradient maker (excluding diagonal gradients). Does this scream easy-to-use?
$cs->load('images');
$cs->images->gradient(Array(
'direction' => 'horizontal',
'width' => 20,
'height' => 20,
'start' => '#000000',
'finish' => '#ffffff',
'type' => 'gif'
));
direction can be horizontal, vertical, h, or v.
start and finish can be hexadecimal, CSL RGB (255,128,64), or an array of RGB (Array(255, 128, 64)). I couldn't think of any other ways to format a color, except HSL, and IDK how one would tell the difference between HSL and RGB. So, it accepts those things, outputs an image in specified format (type).
I was hesitant to use an array as a parameter, since it's not standard (and complicates the length and opening/closing tags), but I think it has too many parameters that it would be more complicated to memorize the order of parameters, so I simplified it to one. Opinions on that idea?
I know you didn't mean designing the templates. I was thinking more along the lines of what constitutes when each template loads and where each section of HTML goes (headers, footers, etc.), but I guess I could leave that to them to code.
what is the point of framework
Yeah, I know of that. I discovered it via a typo, interestingly enough.
echo $$Variable; // hi
It probably is non-standard. That's just the way I managed to stumble upon it, since it's easy to typo. The $$var I typo'd just happened to have a value associated with it.
I'll start using ${$var} from now on.
Do you know if $begining{$end} works? e.g.
$beginningtest = 1;
$var = "test";
echo $beginning{$var}; // 1
'cause it doesn't work with $beginning$var, and it would be useful, methinks.
Cool thanks. I'll try to remember that. I came across a code before that could have used that last one.