PhpBase Logo

Documentation

PhpBase project started the 22nd November 2005, and still in its initial phase, so documentation is not its biggest strength.

I've managed to code in a PEAR like style with JavaDoc style documentation blocks. Unit tests are also included for reference.

Once the initial code base is ready, I'll publish the API on this site.

In the meantime you can have an idea of how this library works, looking at the following samples included in the README file:

Usage

You can start using this library by including in your source the file PhpBase.php.

require_once( 'phpbase/PhpBase.php' );

$PhpBase =&new PhpBase ( 'Housing' );

Where Housing is the schema found at phpbase/schemes/Housing.php

$PhpBase -> setDomain ( 'example.com' );

If a domain name is specified, it will be appended to the id attribute.

$my_properties =array(
'12-LKF' => array(
'title' => 'Nicehouseonthebeach' ,
'description' => 'Nicehousewithviewstobay,
Ithasanenormousdeckforupto10boats'
)),
'14-LKF' => array(
'title' => 'ApartmentinSanFrancisco' ,
'description' => 'Cuteapartmentforsubletin
downtownSanFrancisco'
)),
//.........morepropertieshere
);

if(
$PhpBase -> addItems ( $my_properties )){
if(
$PhpBase -> send ( 'username' ,
'password' , 'filename' )){
echo
"Datawassubmitted
successfullytoGoogleBase"
;
}else{
echo
"Therewasanerroron
theFTPconnectiontoGoogleBase"
;
}
}else{
echo
"Ooops,therewheresome
problemswhenpreparingthedatafeed.
Thesearetheattributes
wherewefoundtheproblems"
;
echo
join ( $PhpBase -> getAttributesWithProblems ());
}

You can also add row by row like this

if(! $PhpBase -> addItem ( $single_property_array )){
echo
"Therewasanerroron" .
$PhpBase -> lastError ();
}

and the send it normally data as on previous example using

// You need to get a valid FTP user and password from the Google Base bulk upload page (YOU CANT USE YOUR GMAIL/GOOGLE ACCOUNT DETAILS)
$PhpBase -> send ( 'username' ,
'password' , 'filename' );

In order to create you own schema have a look to schemes/Housing.php and to the attribute helpers in the attributes/ folder