PHPackages                             actra/backend - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. actra/backend

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

actra/backend
=============

A backend management library for the YUF framework, providing user account management and one-time token authentication via email.

v0.10.4(3w ago)0119↑150%MITPHPPHP &gt;=8.5

Since Apr 25Pushed 1mo agoCompare

[ Source](https://github.com/Actra-AG/backend)[ Packagist](https://packagist.org/packages/actra/backend)[ RSS](/packages/actra-backend/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (2)Versions (33)Used By (0)

Actra Backend
=============

[](#actra-backend)

A comprehensive backend management library for the [YUF framework](https://github.com/Actra-AG/yuf). This library provides a ready-to-use administrative interface with user account management and secure authentication using one-time tokens sent via email.

Features
--------

[](#features)

- **One-Time Token Authentication**: Secure login without passwords, using tokens sent to the user's email.
- **User Management**: Add, modify, and invite users to the system, including phone number support.
- **User Profile Management**: Logged-in users can update their own profile details, IP whitelist, and API key.
- **API Key Management**: Generate hashed API keys for users and validate bearer tokens for API access.
- **User Notifications**: Send email notifications to specific user groups directly from the backend.
- **Role-Based Access Control**: Basic functionality to manage user permissions.
- **IP Whitelisting**: Additional security layer to restrict backend access.
- **Activity Monitoring**: Track visits and token usage.
- **Responsive UI**: Built-in HTML templates for common backend tasks.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.5
- `actra/yuf` framework

Installation
------------

[](#installation)

### 1. Composer

[](#1-composer)

Add the library to your project via Composer:

```
composer require actra/backend
```

### 2. Database Setup

[](#2-database-setup)

The library requires several database tables to function. For new installations, import the provided SQL files into your database:

1. Import `db/schema.sql` to create the required table structure.
2. Import `db/data.sql` to populate the tables with initial data, including a test user account.

For existing installations, apply the incremental SQL update files from `db/updates/` as documented in [UPGRADE.md](UPGRADE.md).

Usage
-----

[](#usage)

To integrate the backend into your YUF-based application, you need to call `ActraBackend::init()` during your application's bootstrap process.

### Basic Initialization

[](#basic-initialization)

```
use actra\backend\ActraBackend;
use actra\backend\settings\MailerSettings;
use actra\yuf\db\DbSettingsModel;

// ... initialize your $routeCollection, $language, $navigationItemCollection ...

ActraBackend::init(
    routeCollection: $routeCollection,
    path: '/backend/', // The URL path where the backend will be accessible
    isDefaultForLanguage: false,
    language: $language,
    ipWhitelist: ['127.0.0.1'], // Allowed IP addresses
    backendName: 'My Project Backend',
    javaScriptPaths: [
        '/assets/js/backend.js'
    ],
    stylesHref: '/assets/css/backend.css',
    dbSettingsModel: new DbSettingsModel(
        hostname: 'localhost',
        username: 'db_user',
        password: 'db_password',
        database: 'my_database'
    ),
    mailerSettings: new MailerSettings(
        senderEmail: 'noreply@example.com',
        senderName: 'My Project',
        hostname: 'smtp.example.com',
        username: 'mailer@example.com',
        password: 'smtp_password',
        port: 587,
        tls: true,
        signature: 'Best regards, Your Team'
    ),
    navigationItemCollection: $navigationItemCollection,
    maxAllowedLoginAttempts: 5, // Optional, defaults to 5
    frontendHref: 'https://example.com', // Optional
    frontendName: 'Go to Website' // Optional
);
```

Once initialized, the library automatically registers the necessary routes under the specified path (e.g., `/backend/`) and adds navigation items to your `NavigationItemCollection`.

### API Key Authentication

[](#api-key-authentication)

Users with management access can generate, replace, or remove a user's API key on the user detail page. Logged-in users can also manage their own API key on their profile page.

API keys can only be generated if an IP whitelist is configured for the user. If an API key exists, the user's IP whitelist cannot be emptied until the API key has been removed. Generated keys are shown only once and stored hashed with a salt.

API clients should send the generated key as a bearer token:

```
Authorization: Bearer api_key__
```

To validate the bearer token and retrieve the authenticated user ID, use:

```
use actra\backend\libs\db\DbAuthApiKeyRepository;
$userID = DbAuthApiKeyRepository::getUserIDForBearerOrThrow();
```

If the bearer token is missing, malformed, unknown, or invalid, an `UnauthorizedException` is thrown.

Documentation
-------------

[](#documentation)

- [Upgrade Guide](UPGRADE.md) - Record of changes and migration instructions.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Author
------

[](#author)

- **Actra AG** -

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance94

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

32

Last Release

23d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/db110c9aa8b7f41b77d42bb1d3da4d493aa513e9a4f5a49e20169e46ee9c653f?d=identicon)[JayQ1982](/maintainers/JayQ1982)

---

Top Contributors

[![JayQ1982](https://avatars.githubusercontent.com/u/6882691?v=4)](https://github.com/JayQ1982 "JayQ1982 (31 commits)")

### Embed Badge

![Health badge](/badges/actra-backend/health.svg)

```
[![Health](https://phpackages.com/badges/actra-backend/health.svg)](https://phpackages.com/packages/actra-backend)
```

###  Alternatives

[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)[firemultimedia/mautic-multi-captcha-bundle

This plugin brings Google's reCAPTCHA, hCaptcha, and Cloudflare Turnstile integration to mautic.

141.3k](/packages/firemultimedia-mautic-multi-captcha-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
