1. Go to this page and download the library: Download chandan07cse/elham 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/ */
chandan07cse / elham example snippets
sh
cd YOUR_PROJECT_NAME/public
php -S localhost:8000
sh
php elham
sh
use Phinx\Migration\AbstractMigration;
class Students extends AbstractMigration
{
public function up()
{
$students = $this->table('students');
$students->addColumn('name','string',['length'=>100])
->addColumn('roll','string')
->create();
}
public function down()
{
$this->dropTable('students');
}
}
sh
use Phinx\Seed\AbstractSeed;
class UserSeeder extends AbstractSeed
{
public function run()
{
}
}
sh
use Phinx\Seed\AbstractSeed;
class UserSeeder extends AbstractSeed
{
public function run()
{
$faker = Faker\Factory::create();
$data = [];
for ($i = 0; $i < 4; $i++) {
$data[] = [
'username' => $faker->userName,
'password' => md5($faker->password),
'email' => $faker->email,
'image' => $faker->image($dir = 'public/images',$width = 640, $height = 480),
'activation_code'=> $faker->randomElement(),
'active' => $faker->boolean
];
}
$this->insert('users', $data);
}
}
sh
$environment = new Dotenv\Dotenv(__DIR__);
$environment->load();
sh
$pdo = $pdo->prepare("insert into users values(:id,:username,:email,:password,:image,:activation_code,:active)");
$pdo->execute([':id'=>null,':username'=>'moin07cse',':password'=>'hjkkjhkjjk',':image'=>'moin.png',':activation_code'=>'dfsf',':active'=>0]);
$pdo->fetchAll(PDO::FETCH_ASSOC);