PHP code example of furiosojack / lara-exception

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

    

furiosojack / lara-exception example snippets


'providers' => [
    FuriosoJack\LaraException\Providers\LaraExceptionServiceProvider::class,
];

'aliases' => [
    'LaraException' => FuriosoJack\LaraException\Facades\LaraExceptionFacade::class,
  ],

 use FuriosoJack\LaraException\Exceptions\LaraExceptionManager;
 

        
    namespace App\Exceptions;
    
    use Exception;
    use Illuminate\Auth\AuthenticationException;
    use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
    use FuriosoJack\LaraException\Exceptions\LaraExceptionManager;
    class Handler extends LaraExceptionManager
    {
        
    

 \LaraException::message("hola mundo")->build();

 \LaraException::message("hola mundo")->debugCode(15)->build();

  \LaraException::message("hola mundo")
  ->debugCode(15)
  ->details("Ya dije hola mundo?")
  ->build();
 

  \LaraException::message("hola mundo")
  ->debugCode(15)
  ->details("Ya dije hola mundo?")
  ->withLog()
  ->build();
 

  \LaraException::message("hola mundo")
  ->debugCode(15)
  ->details("Ya dije hola mundo?")
  ->withLog()
  ->showDetails()
  ->showErrors()
  ->build();


  \LaraException::message("hola mundo")
  ->debugCode(15)
  ->details("Ya dije hola mundo?")
  ->withLog()
  ->errors([
    "juan" => "nombre invalido",
    "petro" => "nombre no existe"
  ])
  ->showDetails()
  ->build();


  lara_exception("hola mundo")
  ->debugCode(15)
  ->details("Ya dije hola mundo?")
  ->withLog()
  ->errors([
    "juan" => "nombre invalido",
    "petro" => "nombre no existe"
  ])
  ->showDetails()
  ->build();


  'blog' => [
      'view' => 'blog.user.exceptions',
      'redirect' => true
  ]

lara_exception("mensaje")
->style('blog')
->details('detalles de la excepcion')
->build(500);
 
        lara_exception_masterManager()->addExceptionCallBack(function($request, \Exception $exception){
            if(strpos($request->getPathInfo(),"/blog") !== FALSE){
                if($exception instanceof NotFoundHttpException){
                    lara_exception("Not Fount")->style('blog')->build(404);
                }
            }
        });
bash
 $ php artisan vendor:publish --tag=config.lara_exception
json
{
    "error": "hola mundo",
    "errors": {
        "juan": "nombre invalido",
        "petro": "nombre no existe"
    },
    "debugCode": 15,
    "details": "Ya dije hola mundo?",
    "success": false
}
bash
 $ php artisan vendor:publish --tag=views.lara_exception