This advertising management module for Juzaweb CMS supports both banner and video ads, with flexible display placement management capabilities.
This module is part of Juzaweb CMS. To install:
composer require juzaweb/ads-manager
Register ad positions in your theme or module:
use Juzaweb\Modules\AdsManagement\Facades\Ads;
// Register banner position
Ads::position('header-banner', function () {
return [
'name' => 'Header Banner',
'type' => 'banner',
];
});
// Register video position
Ads::position('video-preroll', function () {
return [
'name' => 'Video Pre-roll',
'type' => 'video',
];
});
// In Blade template
{!! ads_position('header-banner') !!}
use Juzaweb\Modules\AdsManagement\Facades\Ads;
$banner = Ads::getBanner('header-banner');
if ($banner) {
echo $banner->getBody();
}
use Juzaweb\Modules\AdsManagement\Models\BannerAds;
use Juzaweb\Modules\AdsManagement\Enums\BannerAdsType;
$banner = BannerAds::create([
'name' => 'Homepage Banner',
'body' => 'uploads/banner.jpg', // For image type
'url' => 'https://example.com',
'type' => BannerAdsType::TYPE_BANNER,
'active' => true,
]);
// Assign to position
$banner->positions()->create([
'position' => 'header-banner',
'theme' => 'default',
]);
use Juzaweb\Modules\AdsManagement\Models\VideoAds;
$videoAd = VideoAds::create([
'name' => 'Pre-roll Ad',
'title' => 'Watch this ad',
'url' => 'https://example.com',
'video' => 'https://example.com/ad-video.mp4',
'position' => 'pre-roll',
'offset' => 0,
'active' => true,
]);
use Juzaweb\Modules\AdsManagement\Models\BannerAds;
// Get active banners for specific position
$banners = BannerAds::whereFrontend()
->wherePosition('header-banner')
->get();
// Get all banner positions
$positions = Ads::bannerPositions();
// Get all video positions
$positions = Ads::videoPositions();
The module automatically registers menus in the admin panel:
banner-ads.index: View banner ads listvideo-ads.index: View video ads listGET /admin-cp/banner-ads - List banner adsGET /admin-cp/banner-ads/create - Create banner ad formPOST /admin-cp/banner-ads - Store new banner adGET /admin-cp/banner-ads/{id}/edit - Edit banner ad formPUT /admin-cp/banner-ads/{id} - Update banner adDELETE /admin-cp/banner-ads/{id} - Delete banner adSimilar routes for video ads at /admin-cp/video-ads
The module supports VAST (Video Ad Serving Template) for serving video ads:
Juzaweb\Modules\AdsManagement\Vast\Document - VAST document builderJuzaweb\Modules\AdsManagement\Vast\Factory - Factory for creating VAST elementsPublish config file:
php artisan vendor:publish --tag=ad-management-config
Config file location: config/ad-management.php
The module supports multiple languages including:
composer test
The module follows PSR-2 coding standards.
MIT License
The Anh Dang - Juzaweb CMS
For issues and feature requests, please use the GitHub issue tracker.
No reviews yet.
0 Comments