PHP code example of codalaya / php-project-install-wizard

1. Go to this page and download the library: Download codalaya/php-project-install-wizard 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/ */

    

codalaya / php-project-install-wizard example snippets


use Codalaya\LaravelInstaller\Contracts\CreatesInstallAccount;

class CreateAdminAccount implements CreatesInstallAccount
{
    public function create(array $data): ?int
    {
        $user = \App\Models\User::create([...$data, 'password' => bcrypt($data['password'])]);
        $user->assignRole('admin');

        return $user->id;
    }
}

class License
{
    public static function host(): string;                 // this site's domain
    public static function isLocal(string $host): bool;    // true = the code is optional here
    public static function activate(string $code): array;  // throw ValidationException (key "purchase_code") to refuse
}

use Codalaya\LaravelInstaller\Main\InstalledManager;

InstalledManager::isInstalled();   // bool
InstalledManager::record();        // the installations row (version, installed_at, …) or null