BetterPHP PHP Library

Written something you are proud of, post it here.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

BetterPHP PHP Library

Post 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
Image
Carbine
Posts: 58
Joined: Fri May 06, 2011 1:47 pm
Location: UK, Nottinghamshire
Contact:

Re: BetterPHP PHP Library

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post 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.
Image
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

Added the start of a list to give you the idea ;)
Image
Tino
Posts: 360
Joined: Thu May 05, 2011 8:55 pm
Location: The Netherlands

Re: BetterPHP PHP Library

Post 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.
Please check out my CodeCanyon items.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post 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 ;)
Image
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post by Kamal »

Here is my database class (until Tino posts his):
https://github.com/LearnWebDev/PHP-Database-Class
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: BetterPHP PHP Library

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post 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 :)
Image
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post 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.
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post 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?
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post 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 :)
Last edited by Kamal on Thu May 12, 2011 3:27 pm, edited 1 time in total.
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: BetterPHP PHP Library

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post 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 :? ?
Image
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post 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 ?
Image
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

It makes it easier to access them :?

Can you give a usage example ?
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post 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?
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post by Kamal »

jacek wrote:It makes it easier to access them :?

Can you give a usage example ?
index.php has an example.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post 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.
Image
Post Reply