1. Go to this page and download the library: Download adhocrat-io/arkhe-main library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
adhocrat-io / arkhe-main example snippets
use Arkhe\Main\Concerns\HasBackendProfile;
class User extends Authenticatable
{
use HasBackendProfile; // ⚠ already pulls in Spatie's HasRoles — do NOT add `use HasRoles;` separately.
}
// config/arkhe.php
'roles' => [
'root' => 'root',
'administrator' => 'administrateur',
'manager' => 'manager', // new role, ranks between admin and user
'user' => 'user',
'guest' => 'guest',
],
use Arkhe\Main\Support\RoleHierarchy;
public function boot(): void
{
RoleHierarchy::register('manager', after: 'administrateur');
RoleHierarchy::register('editor', before: 'user');
RoleHierarchy::register('intern'); // append at the lowest rank
}
// config/arkhe.php
'permission_groups' => [
// A group name that is itself a permission shows at the head of its own group.
'manage-users' => ['view-user', 'create-user', 'update-user', 'delete-user'],
// Or a plain label.
'Content' => ['view-article', 'publish-article'],
],
use Arkhe\Main\Concerns\HasArkheSeo;
class Post extends Model
{
use HasArkheSeo;
}
'sitemap' => [
'enabled' => env('ARKHE_SITEMAP_ENABLED', true),
'url' => env('ARKHE_SITEMAP_URL'), // null → falls back to config('app.url')
'path' => env('ARKHE_SITEMAP_PATH'), // null → falls back to public_path('sitemap.xml')
'schedule' => env('ARKHE_SITEMAP_SCHEDULE', '0 3 * * *'),
],
// config/arkhe.php
'components' => [
'list-users' => App\Livewire\Admin\Users\AppListUsers::class,
],
// app/Livewire/Admin/Users/AppListUsers.php
class AppListUsers extends \Arkhe\Main\Livewire\ListUsers
{
protected function afterCreate(Model $user, array $payload): void
{
app(NewsletterService::class)->subscribe($user, 'admin');
}
public function resetPassword(int $id): void
{
// extra wire:click target — works because the route already resolves to this class
}
}
class MyUserForm extends \Arkhe\Main\Livewire\Forms\UserForm
{
public function toPayload(): array // was toArray()
{
return array_merge(parent::toPayload(), ['team_id' => $this->teamId]);
}
}