PHP code example of nahid / hookr

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

    

nahid / hookr example snippets


Nahid\Hookr\HookrServiceProvider::class,

'Hook'  =>  Nahid\Hookr\Facades\Hook::class,

  use Nahid\Hookr\Facades\Hook;
  
  class BlogController extends Controller
  {
        public function getWritePost()
        {
            Hook::bindAction('buttons', function() {
                echo ' <button class="btn btn-info">Draft</button>';
            }, 2);
            
            return view('post');
       }
  }
  

  use Nahid\Hookr\Facades\Hook;
  
  class BlogController extends Controller
  {
        public function getPosts()
        {
            Hook::bindFilter('posts', function($data) {
                return parse_markdown($data);
            }, 2);
            
            return view('post');
       }
  }
  

  use Nahid\Hookr\Facades\Hook;
  
  class BlogController extends Controller
  {
        public function getPosts()
        {
            Hook::bindFilter('posts', function($data) {
                return parse_markdown($data);
            }, 2);

            Hook::bindFilter('posts', function($data) {
                return parse_bbcode($data);
            }, 3);
            
            return view('post');
       }
  }