1. Go to this page and download the library: Download ptejada/uflex 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/ */
ptejada / uflex example snippets
stantiate the User object
$user = new ptejada\uFlex\User();
// Add database credentials
$user->config->database->host = 'localhost';
$user->config->database->user = 'test';
$user->config->database->password = 'test';
$user->config->database->name = 'uflex_test'; //Database name
// OR if in your project you already have a PDO connection
// $user->config->database->pdo = $existingPDO;
/*
* You can update any customizable property of the class before starting the object
* construction process
*/
//Start object construction
$user->start();
class MyUser extends ptejada\uFlex\User {
public function __construct()
{
parent::__construct();
//Add database credentials
$this->config->database->host = 'localhost';
$this->config->database->user = 'test';
$this->config->database->password = 'test';
$this->config->database->name = 'uflex_test'; //Database name
// Start object construction
$this->start();
}
}
$data = array(
'name' => 'pablo',
);
if (isset($data['quote']) && $data['quote'])
{
echo $data['name'] . "'s quote is: " . $data['quote'];
}
else
{
echo $data['name'] . " has no quote";
}
$data = ptejada\uFlex\Collection(array(
'name' => 'pablo',
));
if ($data->quote)
{
echo "{$data->name}'s quote is: $data->quote";
}
else
{
echo "{$data->name} has no quote";
}
$user = new ptejada\uFlex\User();
// Change the session namespace
$user->config->userSession = 'myUser';
$user->start();
// Shows session right after the User object has been started
print_r($_SESSION);
// Stores something in the session
$user->session->myThing = 'my thing goes here';
// Shows the session with the content of the myThing property
print_r($_SESSION);
// Stores something in the PHP session outside of the namespace scope managed by the User class
$_SESSION['other'] = 'other information stored here';
print_r($_SESSION);
// Only destroys the session namespace managed by the User Class
$user->session->destroy();
print_r($_SESSION);
<php
class User extends ptejada\uFlex\User{
/*
* Add your default properties values
* such as database connection credentials
* user default information
* Or cookie preferences
*/
/*
* Create your own methods
*/
function updateAvatar(){}
function linkOpeniD(){}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.