Page 1 of 5

BetterPHP PHP Library

Posted: Wed May 11, 2011 12:48 pm
by jacek
So it was suggested that we could come up with a set of library files for everyone to use, which is something I have made for myself, but it would be nice to have something a bit more extensive.

So the idea is that each user will be assigned a thing to make, well you will volunteer, but we need to assign tasks to make sure there are no duplicates.

The layout will be the same as the one I use which is a load of files that to certain things in a folder, and you just copy the ones that you need into your project folder.

My first contribution is this...
<?php

/*
 *
 *		This file loads all file in the same folder as it.
 *
 */

$files = glob(dirname(__FILE__) . DIRECTORY_SEPARATOR . '*.inc.php');

foreach ($files as $file){
	include($file);
}

?>
Which is a lazy way of including all of the .inc.php files in the same folder as it. this would be "load_all.php" from the library folder.

So now we just need ideas of what the components of the library should do, comments ? I'll add a plan or something as we discuss :D

Who Will Do What ?
  • MySQL class - Tino
  • Something to deal with efficiently sending mass email - jacek
  • String functions - jacek
  • HTTP functions - jacek
  • File functions - jacek
  • User Account System - bowersbros
  • Data Validation Helper - bowersbros
  • ??
Download
https://github.com/betterphp/BetterPHP- ... all/master

Github
https://github.com/betterphp/BetterPHP-PHP-Library

Re: BetterPHP PHP Library

Posted: Wed May 11, 2011 2:25 pm
by Carbine
Well is the libary just going to be for specific things (i.e images) or just filled with any function? Because I think an image libary that uses default functions, but takes it further would be nice.

Re: BetterPHP PHP Library

Posted: Wed May 11, 2011 2:48 pm
by jacek
Some kind of image manipulation thing could be a part of it yeah. But overall it should be things that take a bit of the pain out of the things you have to do over and over and over, a mysql class is the most obvious.

Re: BetterPHP PHP Library

Posted: Wed May 11, 2011 3:12 pm
by jacek
Added the start of a list to give you the idea ;)

Re: BetterPHP PHP Library

Posted: Wed May 11, 2011 3:41 pm
by Tino
I'll take the MySQL class. I used to have one but lost it somewhere quite a while ago, so I will have to rewrite it.

Re: BetterPHP PHP Library

Posted: Wed May 11, 2011 3:45 pm
by jacek
Cool cool,

we will need things like http://betterphp.co.uk/board/viewtopic.php?f=5&t=8 too so its not all complicated boring things ;)

Re: BetterPHP PHP Library

Posted: Wed May 11, 2011 5:56 pm
by Kamal
Here is my database class (until Tino posts his):
https://github.com/LearnWebDev/PHP-Database-Class

Re: BetterPHP PHP Library

Posted: Wed May 11, 2011 6:14 pm
by EcazS
Kamal wrote:Here is my database class (until Tino posts his):
https://github.com/LearnWebDev/PHP-Database-Class
Looks like a REALLY useful thing!!! :shock:
But what does is_object($log) mean? $log is obviously the query.

Re: BetterPHP PHP Library

Posted: Wed May 11, 2011 7:00 pm
by jacek
Kamal wrote:Here is my database class (until Tino posts his):
https://github.com/LearnWebDev/PHP-Database-Class
Not really much point if Tino is making one :?

Feel free to volunteer something else though :)

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 9:47 am
by Kamal
EcazS wrote:
Kamal wrote:Here is my database class (until Tino posts his):
https://github.com/LearnWebDev/PHP-Database-Class
Looks like a REALLY useful thing!!! :shock:
But what does is_object($log) mean? $log is obviously the query.
If an error occurs it returns the error as a string instead of the object itself. So if it is still an object there is no error.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 2:23 pm
by bowersbros
I cant think of what to make, PM me suggetsions? (so nobody else steals ;) )

I guess i could make a 'basic' user class?

- register
- login
- account levels
- change details
- validate email

And such?

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 3:08 pm
by Kamal
SimpleURL Class:
A clean url helper class, to process custom clean urls.

https://github.com/LearnWebDev/PHP-SimpleURL-Class

-This is actually a part of my framework :)

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 3:24 pm
by Temor
bowersbros wrote:I cant think of what to make, PM me suggetsions? (so nobody else steals ;) )

I guess i could make a 'basic' user class?

- register
- login
- account levels
- change details
- validate email

And such?
That would be awesome.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 3:48 pm
by jacek
How about separating the validate email part out into a separate validation file ?

There are a few common things that are validated and that would be useful to have.

I'll add "user system" and "validation" to the list, bowersbros, do you want to do both ? I pretty much have a validation class that we could use so I can take that if you want ?
Kamal wrote:SimpleURL Class:
A clean url helper class, to process custom clean urls.
What exactly does it do :? ?

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 3:49 pm
by Kamal
jacek wrote:How about separating the validate email part out into a separate validation file ?

There are a few common things that are validated and that would be useful to have.

I'll add "user system" and "validation" to the list, bowersbros, do you want to do both ? I pretty much have a validation class that we could use so I can take that if you want ?
Kamal wrote:SimpleURL Class:
A clean url helper class, to process custom clean urls.
What exactly does it do :? ?
See index.php (or the class itself) in the github link.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 3:54 pm
by jacek
Kamal wrote:See index.php (or the class itself) in the github link.
I already looked, you have no docs at all :?

What does this do that parse_url() cant ?

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 3:58 pm
by Kamal
jacek wrote:
Kamal wrote:See index.php (or the class itself) in the github link.
I already looked, you have no docs at all :?

What does this do that parse_url() cant ?
This makes it easier to access URLs such as /shop/account/history/93285kg42 or something like that.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 4:19 pm
by jacek
It makes it easier to access them :?

Can you give a usage example ?

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 4:24 pm
by bowersbros
Yes ill take both

OOP yes?

/edit: Do we use other classes within our class (from the system) Eg. on registration have it validated within my class or have it so the user has to call each individually?

like:

Code: Select all

$name = new User;
$name = User::checkValidation($name);
$name = User::checkAvailability($name);
$name = User::RegisterUser($name);
 
or have it all done within Register User?

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 4:31 pm
by Kamal
jacek wrote:It makes it easier to access them :?

Can you give a usage example ?
index.php has an example.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 4:33 pm
by jacek
bowersbros wrote:Yes ill take both
fair enough :D
bowersbros wrote:OOP yes?
If it makes sense, don't just do it so you can say you have used OOP ;)
bowersbros wrote:/edit: Do we use other classes within our class (from the system) Eg. on registration have it validated within my class or have it so the user has to call each individually?
That brings me on to an important point... dependencies ! If your library file uses one or more of the other files then a list of the ones it needs should be in the header comment... eg.
/*
 *
 *		This class provides an interface to work with imap and smtp servers.
 * 
 *		Requirements:
 *			- string.func.inc.php
 *			- error.func.inc.php
 *			- http.class.inc.php
 *
 */
EDIT: Added a few things that I had lying around ;) See the zip file on the first post, that is the structure I was thinking of.