VOOZH about

URL: https://deepwiki.com/hypervel/permission/7-api-reference

⇱ API Reference | hypervel/permission | DeepWiki


Loading...
Menu

API Reference

This page documents the contracts and interfaces that define the public API of the Hypervel Permission system. These contracts specify the required methods and signatures for permission management functionality.

For implementation details, see page 5.1 (Service Providers and Configuration). For configuration options, see page 5.2 (Configuration Reference).

Contract Overview

The system defines three contracts:

ContractLocationPurpose
Factorysrc/Contracts/Factory.php9Model resolution, cache management, cache key generation
Rolesrc/Contracts/Role.php12Role-permission relationship definition
Permissionsrc/Contracts/Permission.php12Permission-role relationship definition

Sources: src/Contracts/Factory.php9-34 src/Contracts/Role.php12-18 src/Contracts/Permission.php12-18

Contract Structure

Contract code entity relationships:


Sources: src/Contracts/Factory.php9-34 src/Contracts/Role.php12-18 src/Contracts/Permission.php12-18

Factory Contract

The Factory contract src/Contracts/Factory.php9 defines 12 methods organized into five functional categories:

Method Categories

Factory method organization by responsibility:


Sources: src/Contracts/Factory.php11-33

Complete Method Signatures

LineMethod SignatureReturn Type
11getRoleClass()mixed
13getPermissionClass()mixed
15getCache()?Repository
17getOwnerRolesCacheKey(string $ownerType, int|string $ownerId)string
19getOwnerPermissionsCacheKey(string $ownerType, int|string $ownerId)string
21getAllRolesWithPermissions()array
23cacheOwnerRoles(string $ownerType, int|string $ownerId, array $roles)void
25cacheOwnerPermissions(string $ownerType, int|string $ownerId, array $permissions)void
27getOwnerCachedRoles(string $ownerType, int|string $ownerId)?array
29getOwnerCachedPermissions(string $ownerType, int|string $ownerId)?array
31clearAllRolesPermissionsCache()void
33clearOwnerCache(string $ownerType, int|string $ownerId)void

Sources: src/Contracts/Factory.php11-33

Model Contracts

Role Contract

The Role contract src/Contracts/Role.php12 defines the relationship method for role models:

LineMethodReturn TypePurpose
17permissions()BelongsToManyMany-to-many relationship with permissions

The contract includes @mixin \Hypervel\Permission\Models\Role src/Contracts/Role.php10 for IDE support.

Sources: src/Contracts/Role.php10-17

Permission Contract

The Permission contract src/Contracts/Permission.php12 defines the relationship method for permission models:

LineMethodReturn TypePurpose
17roles()BelongsToManyMany-to-many relationship with roles

The contract includes @mixin \Hypervel\Permission\Models\Permission src/Contracts/Permission.php10 for IDE support.

Sources: src/Contracts/Permission.php10-17

Parameter Details

Factory Method Parameters

Parameter specifications for methods with arguments:

MethodParameterTypeDescription
getOwnerRolesCacheKey$ownerTypestringFully qualified class name of owner model
$ownerIdint|stringPrimary key of owner instance
getOwnerPermissionsCacheKey$ownerTypestringFully qualified class name of owner model
$ownerIdint|stringPrimary key of owner instance
cacheOwnerRoles$ownerTypestringFully qualified class name of owner model
$ownerIdint|stringPrimary key of owner instance
$rolesarrayArray of role data to cache
cacheOwnerPermissions$ownerTypestringFully qualified class name of owner model
$ownerIdint|stringPrimary key of owner instance
$permissionsarrayArray of permission data to cache
getOwnerCachedRoles$ownerTypestringFully qualified class name of owner model
$ownerIdint|stringPrimary key of owner instance
getOwnerCachedPermissions$ownerTypestringFully qualified class name of owner model
$ownerIdint|stringPrimary key of owner instance
clearOwnerCache$ownerTypestringFully qualified class name of owner model
$ownerIdint|stringPrimary key of owner instance

Sources: src/Contracts/Factory.php17-33

Contract Usage Flow

Factory contract method call sequence:


Sources: src/Contracts/Factory.php17-33

Method Signatures and Parameters

Factory Interface Method Reference

Method SignatureParametersReturn TypeLine Reference
getRoleClass()Nonemixedsrc/Contracts/Factory.php11
getPermissionClass()Nonemixedsrc/Contracts/Factory.php13
getCache()None?Repositorysrc/Contracts/Factory.php15
getOwnerRolesCacheKey(string $ownerType, int|string $ownerId)$ownerType, $ownerIdstringsrc/Contracts/Factory.php17
getOwnerPermissionsCacheKey(string $ownerType, int|string $ownerId)$ownerType, $ownerIdstringsrc/Contracts/Factory.php19
getAllRolesWithPermissions()Nonearraysrc/Contracts/Factory.php21
cacheOwnerRoles(string $ownerType, int|string $ownerId, array $roles)$ownerType, $ownerId, $rolesvoidsrc/Contracts/Factory.php23
cacheOwnerPermissions(string $ownerType, int|string $ownerId, array $permissions)$ownerType, $ownerId, $permissionsvoidsrc/Contracts/Factory.php25
getOwnerCachedRoles(string $ownerType, int|string $ownerId)$ownerType, $ownerId?arraysrc/Contracts/Factory.php27
getOwnerCachedPermissions(string $ownerType, int|string $ownerId)$ownerType, $ownerId?arraysrc/Contracts/Factory.php29
clearAllRolesPermissionsCache()Nonevoidsrc/Contracts/Factory.php31
clearOwnerCache(string $ownerType, int|string $ownerId)$ownerType, $ownerIdvoidsrc/Contracts/Factory.php33

Model Interface Method Reference

InterfaceMethod SignatureReturn TypeRelationshipLine Reference
Rolepermissions()BelongsToManyMany-to-many with permissionssrc/Contracts/Role.php17
Permissionroles()BelongsToManyMany-to-many with rolessrc/Contracts/Permission.php17

Type Annotations and Mixins

InterfaceMixin DeclarationPurpose
Role@mixin \Hypervel\Permission\Models\RoleIDE support for concrete model methods
Permission@mixin \Hypervel\Permission\Models\PermissionIDE support for concrete model methods

Sources: src/Contracts/Factory.php11-33 src/Contracts/Role.php10-17 src/Contracts/Permission.php10-17

Factory Method Implementation Flow

Cache Operation Sequence


Factory Method Categorization by Responsibility


Sources: src/Contracts/Factory.php11-33

Contract Usage Patterns

Resource Access Pattern


Cache Management Pattern


Cache Invalidation Pattern


Sources: src/Contracts/Factory.php11-33