PHP code example of modulusphp / hibernate

1. Go to this page and download the library: Download modulusphp/hibernate 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/ */

    

modulusphp / hibernate example snippets


\Modulus\Hibernate\Session\Middleware\StartSession::class,
\Modulus\Hibernate\Session\Middleware\ShareSessionData::class,

use Modulus\Hibernate\Session\Middleware\VerifyCsrfToken as Middleware;

class VerifyCsrfToken extends Middleware
{
  ...



return [
  'default' => env('SESSION_CONNETION', 'file'),

  'name' => env('SESSION_NAME', 'modulus'),

  'connections' => [
    'file' => [
      'driver' => 'file',
      'files' => storage_path('framework/sessions')
    ],

    'redis' => [
      'driver' => 'redis',
      'connection' => 'session'
    ]
  ]
];

dispatch(new \App\Jobs\<NameOfTheJob>);

dispatch(new \App\Jobs\<NameOfTheJob>, \Carbon\Carbon::now()->addMinutes(10));

cache('user', [
  'name' => 'Donald',
  'age'  => 21,
  'city' => 'East Rand'
]);

cache('user', [
  'name' => 'Donald'
  'age'  => 21,
  'city' => 'East Rand'
], \Carbon\Carbon::now()->addMonth());

Mail::to('[email protected]')->queue(new WelcomeEmail('Donald Pakkies'));



namespace App\Mail;

use Modulus\Hibernate\Mail\Mailable;

class TestMail extends Mailable
{
  /**
   * Handle mailable
   *
   * @return void
   */
  public function handle()
  {
    //
  }

  /**
   * Build email
   *
   * @return Mailable
   */
  public function build()
  {
    return $this;
  }
}

  /**
   * Build email
   *
   * @return Mailable
   */
  public function build()
  {
    return $this->view('testemail');
  }

  /**
   * Build email
   *
   * @return Mailable
   */
  public function build()
  {
    return $this->view('testemail')
                ->with([
                  'name' => 'Donald'
                ]);
  }

Route::get('/test', function () {
  return new App\Mail\TestMail;
});

php craftsman queue:table

php craftsman migrate all

php craftsman craft:job <NameOfTheJob>
bash
php craftsman craft:mail TestMail
bash
touch resources/views/testemail.medusa.php