承接 azmolla/blade-try-catch 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

azmolla/blade-try-catch

最新稳定版本:0.0.3

Composer 安装命令:

composer require azmolla/blade-try-catch

包简介

Blade directives for try-catch-finally blocks in Laravel Blade templates

README 文档

README

Latest Version on Packagist License

Overview

This Laravel package adds native-like @try, @catch, @finally, and @endtry directives to Blade templates, allowing you to handle exceptions gracefully inside your views.

You no longer need to clutter your controllers for simple error handling in views — this package provides a clean, elegant syntax for try-catch-finally in Blade.

Compatible with Laravel 5.8 through 12 and PHP 7.1+.

Installation

You can install the package via Composer:

composer require azmolla/blade-try-catch

The package auto-registers the service provider via Laravel's package discovery. No manual provider registration needed.

Usage

Use the directives in any Blade view:

@try
    {{-- Code that may throw an exception --}}
    {{ riskyFunction() }}
@catch(\Exception $e)
    {{-- Handle the exception --}}
    <div class="error">Error: {{ $e->getMessage() }}</div>
@finally
    {{-- Code that always runs --}}
    <p>Cleanup completed.</p>
@endtry

Testing

This package uses Pest for testing.

To run tests locally:

composer test

Make sure to install development dependencies before running tests:

composer install --dev

Contributing

Contributions, issues, and feature requests are welcome!

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m 'Add new feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a pull request

Please ensure your code passes existing tests and write new tests if applicable.

Links & Credits

License

MIT © 2025 Abiruzzaman Molla

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-08