Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Kalinka Bundle

Kalinka Bundle Laravel Package

ac/kalinka-bundle

Symfony2 bundle integrating the Kalinka authorization library. Configure role/action policies via YAML, set default/anonymous/authenticated roles, inject the kalinka.authorizer service to check permissions, and register custom guards with the kalinka.guard tag.

View on GitHub
Deep Wiki
Context7

Flexible authorization for your Symfony2 app

Frequently asked questions about Kalinka Bundle
Can I use Kalinka-Bundle directly in Laravel, or is it only for Symfony?
Kalinka-Bundle is designed for Symfony2 and won’t work in Laravel without significant refactoring. However, the underlying **Kalinka library** (PHP 5.4+) could be integrated standalone by wrapping its logic in a Laravel Service Provider. The Symfony-specific glue code (e.g., `ACKalinkaBundle`) would need removal or replacement.
What’s the easiest way to get Kalinka’s RBAC features in Laravel?
For Laravel, consider **Spatie’s Laravel-Permission** or **Entrust** for built-in RBAC. If you need Kalinka’s dynamic guard policies (e.g., `['owner', 'unlocked']`), fork the **Kalinka library**, strip Symfony dependencies, and create a custom Laravel facade/service. Test thoroughly—Kalinka’s PHP 5.4+ support may conflict with Laravel 9+ (PHP 8.0+).
How does Kalinka’s YAML configuration compare to Laravel’s Gates/Policies?
Kalinka uses **YAML-based role-action mappings** (e.g., `teacher: document: update: ['owner', 'unlocked']`), which is more declarative than Laravel’s Gates/Policies. However, Laravel’s system is more tightly integrated with middleware, route-model binding, and Eloquent. Kalinka’s approach is better for complex, hierarchical permissions but lacks Laravel’s simplicity for basic checks.
Will Kalinka work with Laravel’s Eloquent ORM or Doctrine?
Kalinka’s core logic is ORM-agnostic, but the bundle assumes Symfony’s Doctrine integration. For Eloquent, you’d need to manually implement guard policies (e.g., `owner` checks via `user()->id === $model->user_id`). The bundle’s **`kalinka.authorizer`** service could still work if you bypass Symfony’s ORM layer.
Is Kalinka-Bundle actively maintained? Should I use it in production?
The package is **unmaintained** (0 dependents, no recent updates). For production, fork the **Kalinka library** (not the bundle) and test standalone in Laravel. Alternatively, use **Laravel-Permission** (actively maintained) or Entrust. Kalinka’s MIT license is permissive, but its PHP 5.4+ base may introduce deprecation risks in Laravel 9+.
How do I configure default roles (e.g., authenticated/anonymous) in Laravel if I use Kalinka?
Kalinka-Bundle’s YAML config (e.g., `anonymous_role: 'anonymous'`) won’t translate directly to Laravel. Instead, create a **Service Provider** to initialize Kalinka’s `Authorizer` with default roles. Use Laravel’s `Auth::check()` to dynamically assign roles (e.g., `authenticated`) before permission checks. Example: `$authorizer->setRole($user ? 'authenticated' : 'anonymous');`
Are there performance concerns with Kalinka’s authorization checks?
Kalinka’s resolution is **not cached by default**, unlike Laravel’s Gates (which cache after first use). If your guards involve database queries (e.g., `owner` checks), expect **N+1 risks**. Mitigate this by caching guard results in Laravel’s cache system or using Eloquent’s `with()` for eager loading. Benchmark against Laravel’s native Gates for your use case.
Can I extend Kalinka with custom guards in Laravel?
Yes, but you’ll need to replace Symfony’s `kalinka.guard` tag system. In Laravel, create a **Service Provider** to register guards as singleton bindings. Example: `$this->app->singleton('guard.document', fn() => new DocumentGuard());`. Then inject the guard into Kalinka’s `Authorizer` manually. The guard logic (e.g., `owner` checks) remains the same.
What Laravel versions support Kalinka’s PHP 5.4+ codebase?
Kalinka’s PHP 5.4+ support **conflicts with Laravel 9+**, which requires PHP 8.0+. If you need Laravel 9+, fork Kalinka and update its codebase to PHP 8.0+ (e.g., replace `call_user_func_array` with modern alternatives). For Laravel 8.x, PHP 7.4+ may suffice, but test thoroughly for deprecation warnings.
How do I migrate from Kalinka-Bundle to Laravel’s native Gates/Policies?
Start by mapping Kalinka’s **role-action rules** to Laravel’s Policies (e.g., `DocumentPolicy::update()`). Use Gates for simple checks (e.g., `Gate::define('edit-document', fn() => auth()->user()->isAdmin())`). For complex logic (e.g., `['owner', 'unlocked']`), create a **custom Policy method** that combines multiple checks. Tools like `php artisan make:policy` can accelerate the transition.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware