1. Go to this page and download the library: Download net-tools/core library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
net-tools / core example snippets
// we create a file at $PATH
$fhandle = fopen($path, 'w');
// we create the formatter along with an output strategy, here to a file handle
$csv = new CsvFormatter(new FormatterFileOutputStrategy($fhandle));
// beginning export
$csv->newRow();
$csv->row(array('column1 header', 'column2 header', 'column3 header'));
$csv->closeRow();
$csv->newRow();
$csv->row(array('line2_column1_value', 'line3_column2_value', ''));
$csv->closeRow(true); // true = this is the last row
// closing file handle
fclose($fhandle);
if ( $name = $pdoh->pdo_dbexists('SELECT name FROM Client WHERE id=?', array(123456)) )
echo "found client ; its name is '$name' !";
// defining a schema with 2 tables referencing the Town table through it's idTown column
$pdoh->addForeignKey('Town', 'idTown', ['Client', 'Merchants']);
$test = $pdoh->pdo_foreignkeys('Town', 1234);
if ( $test['statut'] )
// no foreign key detected, we may delete safely the town
echo "deletion is safe";
else
echo "deletion is not safe : " . $test['cause']['message'];
try
{
// some bad code here
}
catch (\Exception $e)
{
(new \Nettools\Core\ExceptionHandlers\SimpleExceptionHandler())->handleException($e);
// the script is halted here
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.