PHP code example of chandan07cse / elham

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()
    {
      $data = array(
          array(
              'username'    => 'chandan07cse',
              'password' => md5('me'),
              'email' => '[email protected]',
              'image' => 'public/images/chandan07cse.jpg',
              'activation_code' => md5(rand(0,1000)),
              'active' => 1
          ),
          array(
              'username'    => 'mamun10pgd',
              'password' => md5('mamun10pgd@!'),
              'email' => '[email protected]',
              'image' => 'public/images/mamun10pgd.jpg',
              'activation_code' => md5(rand(0,1000)),
              'active' => 0
          )
      );

       $this->insert('users', $data);
    }
 }
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);
sh
        $uri = 'http://mockbin.com/request';
        $content_type = 'application/json';
        $request_parameter = ['foo' => 'hello', 'bar' => 'world'];
        $request_type = 'post';
        $api_response = $this->api($uri,$content_type,$request_parameter,$request_type);