Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lakshmaji/exceptions


https://github.com/lakshmaji/exceptions

composer exceptions laravel

Last synced: 7 days ago
JSON representation

Awesome Lists containing this project

README

        

## Laravel Custom Exceptions Package

### Install with composer

```bash
composer require lakshmaji/exceptions
```

Service provider will be registered automatically

Publish translations

```php
php artisan vendor:publish
```

### Custom Exception class

```php

12000, 'code' => 400];

// General Error
/**
* @var array
*/
public static $GENERAL_ERROR = ['error_code' => 10001, 'code' => 400];


}
// end of class GenericExceptionType
// end of file GenericExceptionType.php
```

### Usage
```php
// In controller
throw new GenericException(CustomException::$DUPLICATE_ORGANIZATION);
```

### License

[MIT](https://opensource.org/licenses/MIT)