PHP code example of alareqi / filament-app-version-manager
1. Go to this page and download the library: Download alareqi/filament-app-version-manager 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/ */
alareqi / filament-app-version-manager example snippets
use Alareqi\FilamentAppVersionManager\FilamentAppVersionManagerPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ... other configuration
->plugins([
FilamentAppVersionManagerPlugin::make(),
]);
}
'localization' => [
'supported_locales' => ['en', 'ar'], // Supported locales for multilingual fields
'default_locale' => 'en', // Default locale for API fallback
'fallback_locale' => 'en', // Fallback locale when default is not available
],
'validation' => [
'max_version_length' => 20, // Maximum version string length
'max_build_number' => 99999, // Maximum build number
'max_release_notes_length' => 1000, // Maximum release notes length per locale
],
'defaults' => [
'platform' => 'ios', // Default platform for new versions
'is_active' => true, // Default active status
'is_beta' => false, // Default beta status
'force_update' => false, // Default force update status
],
use Alareqi\FilamentAppVersionManager\Models\AppVersion;
use Alareqi\FilamentAppVersionManager\Enums\Platform;
// Creating a version with multilingual release notes
AppVersion::create([
'version' => '2.0.0',
'platform' => Platform::IOS,
'release_notes' => [
'en' => 'Major update with new features',
'ar' => 'تحديث كبير مع ميزات جديدة',
'fr' => 'Mise à jour majeure avec de nouvelles fonctionnalités'
],
'release_date' => now(),
'download_url' => 'https://apps.apple.com/app/yourapp',
'is_active' => true,
]);
// Note: The release_notes are stored as an array in the database,
// but the API response format depends on whether a locale is specified:
// - Without locale: returns the full array
// - With locale: returns the localized string for that locale
// In your Admin model
public function createdAppVersions()
{
return $this->hasMany(AppVersion::class, 'created_by');
}
public function updatedAppVersions()
{
return $this->hasMany(AppVersion::class, 'updated_by');
}
use Alareqi\FilamentAppVersionManager\Models\AppVersion;
use Alareqi\FilamentAppVersionManager\Enums\Platform;
// Create a basic version
AppVersion::create([
'version' => '1.0.0',
'platform' => Platform::IOS,
'release_date' => now(),
'download_url' => 'https://apps.apple.com/app/yourapp',
'release_notes' => [
'en' => 'Initial release with core features',
'ar' => 'الإصدار الأولي مع الميزات الأساسية'
],
'is_active' => true,
]);
// Create a beta version
AppVersion::create([
'version' => '2.0.0-beta',
'build_number' => '200',
'platform' => Platform::ANDROID,
'release_date' => now()->addWeek(),
'download_url' => 'https://play.google.com/store/apps/details?id=com.yourapp',
'release_notes' => [
'en' => 'Beta version with experimental features',
'ar' => 'نسخة تجريبية مع ميزات تجريبية'
],
'is_active' => true,
'is_beta' => true,
'metadata' => [
'features' => ['New UI', 'Dark mode', 'Performance improvements'],
'known_issues' => ['Minor UI glitches in landscape mode']
]
]);
// Create a force update version
AppVersion::create([
'version' => '1.5.0',
'platform' => Platform::IOS,
'minimum_
// In your test setup
config([
'filament-app-version-manager.api.enabled' => true,
'filament-app-version-manager.api.cache_ttl' => 60,
'filament-app-version-manager.localization.supported_locales' => ['en', 'ar'],
]);
// In a new migration
Schema::table('app_versions', function (Blueprint $table) {
$table->index(['platform', 'is_active']);
$table->index(['version', 'platform']);
});
// In your .env file
APP_DEBUG=true
// Or temporarily in your plugin configuration
FilamentAppVersionManagerPlugin::make()
->configureUsing('debug', true)