- What is linkorb/spicedb-php used for?
- It is a PHP client library for SpiceDB, the open-source authorization database. It lets PHP applications check permissions and manage authorization relationships through a simple SDK. Use it when you want fine-grained, relationship-based access control instead of only local role checks.
- How do I install linkorb/spicedb-php?
- Install it with Composer using composer require linkorb/spicedb-php. Then autoload Composer dependencies and configure the client to connect to your SpiceDB instance. Check the README for the exact client configuration and connection options.
- Does linkorb/spicedb-php work with Laravel?
- Yes, it is a PHP package and can be added to a Laravel application as a Composer dependency. Because the context does not describe a Laravel-specific service provider, you may need to bind and configure the client yourself in a service provider. You can then inject it into controllers, policies, middleware, or services.
- How do I check if a user has permission in SpiceDB from PHP?
- Use the client SDK to call SpiceDB's permission-check functionality with the resource, permission, and subject you want to evaluate. SpiceDB evaluates the relationships and schema you have defined and returns whether access is allowed. Keep permission names and relationship modeling consistent with your SpiceDB schema.
- Can I create and delete SpiceDB relationships with linkorb/spicedb-php?
- The package is described as an SDK for managing authorization relationships as well as checking permissions. That means you can use it to write and remove relationship tuples that represent grants such as ownership, membership, or viewer access. Confirm exact method names and supported operations in the package documentation.
- Do I need to run a SpiceDB server to use linkorb/spicedb-php?
- Yes, linkorb/spicedb-php is a client library for SpiceDB rather than a standalone authorization engine. You need a reachable SpiceDB instance with your schema and relationships loaded. Your PHP app connects to that service to perform permission checks and relationship updates.
- What Laravel or PHP versions does linkorb/spicedb-php support?
- The provided context does not list exact PHP or Laravel version constraints. Check the package composer.json and README for the supported PHP version and any framework requirements. For Laravel, verify compatibility against the framework version in your application before adopting it.
- How is linkorb/spicedb-php different from Laravel Gates and Policies?
- Laravel Gates and Policies typically evaluate authorization inside your application using local code and data. linkorb/spicedb-php delegates relationship-based authorization decisions to a SpiceDB service. This is useful when permissions are complex, shared across services, or modeled as relationships between users, groups, and resources.
- Is linkorb/spicedb-php suitable for production Laravel applications?
- It can be used in production if you properly operate SpiceDB and handle network calls to it. Plan for connection security, timeouts, retries, error handling, and the availability of the SpiceDB service. Also consider caching or fallback behavior for permission checks where appropriate.
- How should I test authorization logic that uses linkorb/spicedb-php?
- Test against a SpiceDB instance loaded with your schema and representative relationships, ideally in an isolated test environment. Cover allowed and denied permission checks plus relationship create, update, and delete flows. You can also wrap the client behind your own interface to make it easier to mock in Laravel tests.