1. Go to this page and download the library: Download defstudio/enum-features 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/ */
use DefStudio\EnumFeatures\EnumFeatures;
enum AppFeature
{
use DefinesFeatures; // ← simply add this
case multi_language;
case impersonate;
case welcome_email;
/* Feature resolution */
//with a single method:
protected function resolve(Authenticatable $user = null) {
match($this){
case self::multi_language => true,
case self::impersonate => $user->isAdmin(),
default => false;
}
}
//or with a dedicated method:
protected function resolveImpersonate(Authenticatable $user = null){
return $user->isSuperAdmin();
}
}
class AppServiceProvider extends ServiceProvider
{
//..
public function boot(): void {
AppFeature::defineFeatures();
}
}
if(AppFeature::multi_language->active()){
//.. multi language specific code
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.