PHP code example of vulcanphp / hyper-admin
1. Go to this page and download the library: Download vulcanphp/hyper-admin 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/ */
vulcanphp / hyper-admin example snippets
use admin\admin;
return new application(
providers: [[new admin(), 'setup']],
env: [
'admin' => __DIR__ . '/web/admin.php',
'admin_prefix' => '/admin',
],
);
# app/web/admin.php
return [
// Admin user configuration
'user' => [
'name' => 'admin', // The username for admin access
'reset' => false // Flag to indicate if password reset is gs.php']
// Example 2: ['cms' => function() {}]
// Example 3: ['api' => 'Hello From Api Key']
],
'settings' => [
// Register all grouped settings
'general' => [
// Register inputs for this group.
// Example 1: ['type' => 'text', 'name' => 'title']
// Example 2: ['type' => 'file', 'name' => 'logo']
],
// ... more groped settings
],
];
# app/web/admin.php
use models\subject;
return [
'models' => [
subject::class,
],
];
# app/web/admin.php
use models\subject;
use models\student;
use admin\core\modelView;
return [
'models' => [
subject::class, // Basic model
new modelView(
model: student::class,
name: 'student',
name_plural: 'students',
fields: ['id', 'name', 'age', 'department'],
search: ['name'],
filter: ['gender' => ['M' => 'Male', 'F' => 'Female']],
with: ['department'],
where: ['deleted' => false],
order: 'id DESC',
actions: ['Export Selected Students Result Sheet' => admin_url('student/export')]
), // Customized model
],
];