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.
Results 1 to 21 of 21
Thread: PHP Framework
- 12 Nov. 2009 08:29pm #1
PHP Framework
- 12 Nov. 2009 09:52pm #2
What is this framework intended for?
- 12 Nov. 2009 10:28pm #3
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.
- 12 Nov. 2009 11:18pm #4
Ah. I see. I haven't worked on those kind of frameworks, I worked with a cURL wrapper framework, and it was pretty decent, some years ago. I haven't used PHP frameworks for website development, so I wasn't sure what the purpose of your framework was.
I would suggest adding functions to create drop down menus, rounded corners (even though there are new functions in CSS that will allow rounded corners, gradients, glow, shadow, etc. on certain browsers: The creative and technical vents of Scott Schiller).
- 12 Nov. 2009 11:41pm #5
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.
- 12 Nov. 2009 11:53pm #6
You could also create a Javascript framework for stuff you can't do with PHP.
- 13 Nov. 2009 03:00am #7
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.
- 13 Nov. 2009 03:08am #8
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.
- 13 Nov. 2009 04:00am #9
Well, of course template systems are nice, but I'm not using this to design my site. Just a quick tool for others to use to do specific tasks. Template systems are a pain in the ass to make accessible to anyone who wants to use them, since templates range so drastically.
I'll def. do a parser system.
- 13 Nov. 2009 11:06pm #10
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?
- 14 Nov. 2009 01:12am #11
I don't mean you make templates. But for example you could have a template file:
blah.tp
HTML Code:<h1>My simply website called $settings['name']</h1> <if $settings['user_location']="America"> Welcome. You are an American citizen! <else> Unfortunately our website is only for Americans. </if> <br /><br /> <if condition="this"> do this </else> do that. </if>
- 14 Nov. 2009 05:33am #12
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.
- 14 Nov. 2009 06:33am #13
what is the point of framework
- 14 Nov. 2009 09:35am #14
Pre-made coding so that you can built your websites faster. Instead of having to learn the entire GD library to figure out how to create an image, set its colors, create an algorithm to calculate a gradient, and output it, you can use someone else's work to create it in merely a few lines of easy-to-understand code.
- 18 Nov. 2009 07:20am #15
- Age
- 30
- Join Date
- Nov. 2009
- Location
- Anaheim, California
- Posts
- 1,065
- Reputation
- 99
- LCash
- 200.00
PHP Code:<?php
$Lol = "hi";
$Variable = "Lol";
echo ${$Variable};
?>
A little code you might be interested in if you are looking to make a template system as Arti mentioned.
- 18 Nov. 2009 07:22am #16
Yeah, I know of that. I discovered it via a typo, interestingly enough.
echo $$Variable; // hi
- 18 Nov. 2009 07:23am #17
- Age
- 30
- Join Date
- Nov. 2009
- Location
- Anaheim, California
- Posts
- 1,065
- Reputation
- 99
- LCash
- 200.00
- 18 Nov. 2009 07:26am #18
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.
- 18 Nov. 2009 07:32am #19
- Age
- 30
- Join Date
- Nov. 2009
- Location
- Anaheim, California
- Posts
- 1,065
- Reputation
- 99
- LCash
- 200.00
PHP Code:<?php
$Test = "Variable";
$Test2 = "Lol";
$VariableLol = "hi";
echo ${$Test . $Test2}; // hi
?>
PHP Code:<?php
$Test = "Variable";
$Test2 = "Lol";
$VariableLol = "hi";
echo $Test{$Test2}; // V
?>
PHP Code:<?php
$Test2 = "Lol";
$VariableLol = "hi";
echo $Variable{$Test2}; // Error'd out.
?>
PHP Code:<?php
$Test2 = "Lol";
$VariableLol = "hi";
echo ${"Variable" . $Test2}; // hi
?>Last edited by Chris; 18 Nov. 2009 at 07:34am.
- 18 Nov. 2009 01:51pm #20
Cool thanks. I'll try to remember that. I came across a code before that could have used that last one.
- 18 Nov. 2009 02:44pm #21
- Age
- 30
- Join Date
- Nov. 2009
- Location
- Anaheim, California
- Posts
- 1,065
- Reputation
- 99
- LCash
- 200.00