- How do I install keboola/common-exceptions with Composer?
- Install it with Composer using composer require keboola/common-exceptions. It is a PHP library, so no Laravel service provider or extra bootstrap step is described in the overview. Composer autoloading makes the exception classes and interfaces available to your application.
- Does keboola/common-exceptions work with Laravel?
- The package is a plain PHP library of common exception classes and interfaces, so it can be used inside Laravel applications. The provided overview does not describe Laravel-specific integrations such as service providers, facades, or config files. Check its Composer requirements to confirm compatibility with your PHP and Laravel versions.
- What problems does keboola/common-exceptions solve?
- It standardizes exception hierarchies, error codes, and structured context for Keboola projects and services. That consistency makes error handling and reporting easier across applications. Use it when you want shared exception types instead of ad hoc exceptions in each codebase.
- Does keboola/common-exceptions provide standardized error codes?
- Yes. The library is described as providing consistent exception hierarchies and error codes. You can rely on those codes when logging, mapping errors to API responses, or routing failures. Check the specific exception classes for the exact code values available.
- How does structured exception context work in keboola/common-exceptions?
- Structured context means exceptions can carry additional data that explains the failure, rather than only a message string. That context can be included in logs or error reports to simplify debugging. The overview presents this as part of the common exception design, not as a logging framework.
- Can I extend keboola/common-exceptions with my own exception classes?
- Yes, the goal of a common exception hierarchy is to provide base classes and interfaces you can reuse. Extend the relevant base exception or implement the provided interface to keep your custom exceptions consistent. Review the available classes before creating new exception types so you do not duplicate existing behavior.
- Does keboola/common-exceptions include interfaces for custom exceptions?
- The package includes interfaces as well as exception classes, according to the overview. Those interfaces let you type-hint against common exception contracts in your own code. Implement them when you need custom exceptions that still fit the Keboola exception hierarchy.
- How should I test code that throws keboola/common-exceptions exceptions?
- Use your normal PHP testing tools, such as PHPUnit, to assert that the expected exception class is thrown. If the exception exposes error codes or context, assert those values directly in the test. Testing the hierarchy and context helps prevent accidental changes to error reporting behavior.
- Is keboola/common-exceptions safe to use in production?
- It is a small Composer library intended for use in Keboola projects and services, so it can be used in production applications. Because it provides exception types rather than runtime infrastructure, production concerns are mainly version pinning and compatibility with your PHP version. Use tagged releases and review changes before upgrading major versions.
- What are alternatives to keboola/common-exceptions, and is it maintained?
- Alternatives include framework-native exceptions, custom base exception classes, or other shared exception libraries. This package is specifically oriented toward Keboola projects and its consistent error codes and context. For maintenance status, check Packagist and the repository release history before adopting it.