LaravelPackages.net
Acme Inc.
Toggle sidebar
mykemeynell/archuser

User Layer Architecture for Laravel (Service, Repository, Entity)

42
0
1.0.8
About mykemeynell/archuser

mykemeynell/archuser is a Laravel package for user layer architecture for laravel (service, repository, entity). It currently has 0 GitHub stars and 42 downloads on Packagist (latest version 1.0.8). Install it with composer require mykemeynell/archuser. Discover more Laravel packages by mykemeynell or browse all Laravel packages to compare alternatives.

Last updated

User Storage Layer Architecture

A small package that sets up a Service, Repository and Entity for user storage. You can extend the classes and interfaces within this package to add your own additional functionality, or use the ones that come with this package as default.

Installation via Composer

  • Get the latest version of ArchUser for your application.

composer require mykemeynell/archuser

  • Include the service provider within your application.
    ...
    
    \ArchLayerUser\Provider\ArchUserServiceProvider::class,
    
    ...
  • Bind the Service, Repository and Entity to your application.
    public function register(): void
    {
        $this->app->bind('user.entity',               \ArchLayerUser\Entity\UserEntity::class);
        $this->app->bind('userRole.entity',           \ArchLayerUser\Entity\UserRoleEntity::class);
        $this->app->bind('userRolePermission.entity', \ArchLayerUser\Entity\UserRolePermissionEntity::class);
        
        $this->app->singleton('user.repository',               \ArchLayerUser\Repository\UserRepository::class);
        $this->app->singleton('userRole.repository',           \ArchLayerUser\Repository\UserRoleRepository::class);
        $this->app->singleton('userRolePermission.repository', \ArchLayerUser\Repository\UserRolePermissionRepository::class);
        
        $this->app->singleton('user.service',               \ArchLayerUser\Service\UserService::class);
        $this->app->singleton('userRole.service',           \ArchLayerUser\Service\UserRoleService::class);
        $this->app->singleton('userRolePermission.service', \ArchLayerUser\Service\UserRolePermissionService::class);
    }
class AppServiceProvider extends ServiceProvider
{
    use mykemeynell\Support\Providers\Concern\AliasService,
        mykemeynell\Support\Providers\Concern\ProvidesService;
        
    /**
     * Services that are to be aliased into application.
     *
     * @var array
     */
    protected $aliases = [
        'user.entity' => [\ArchLayerUser\Entity\Contract\UserEntityInterface::class],
        'userRole.entity' => [\ArchLayerUser\Entity\Contract\UserRoleEntityInterface::class],
        'userRolePermission.entity' => [\ArchLayerUser\Entity\Contract\UserRolePermissionsEntityInterface::class],
        
        'user.repository' => [\ArchLayerUser\Repository\Contract\UserRepositoryInterface::class],
        'userRole.repository' > [\ArchLayerUser\Repository\Contract\UserRoleRepositoryInterface::class],
        'userRolePermission.repository' => [[\ArchLayerUser\Repository\Contract\UserRolePermissionsRepositoryInterface::class]],
        
        'user.service' => [\ArchLayerUser\Service\Contract\UserServiceInterface::class],
        'userRole.service' => [\ArchLayerUser\Service\Contract\UserRoleServiceInterface::class],
        'userRolePermission.service' => [\ArchLayerUser\Service\Contract\UserRolePermissionsServiceInterface::class],
    ];

...
  • Call the AliasService::registerAliases(): void method.
    public function register(): void
    {
        $this->registerAliases();
        
        ...
Comments