digitalstate/platform-portal-bundle
Installation Add the bundle via Composer:
composer require digitalstate/platform-portal-bundle
Register the bundle in config/app.php under ExtraBundles:
DigitalState\PlatformPortalBundle\DigitalStatePlatformPortalBundle::class,
Publish Configuration Run:
php artisan vendor:publish --provider="DigitalState\PlatformPortalBundle\DigitalStatePlatformPortalBundle" --tag="config"
This generates config/platform_portal.php. Review and customize:
routes array)controllers array)assets array)First Use Case: Basic Portal Page
Define a route in routes/web.php:
use DigitalState\PlatformPortalBundle\Controller\PortalController;
Route::get('/portal', [PortalController::class, 'index'])->name('portal.index');
Override the default template by publishing assets:
php artisan vendor:publish --provider="DigitalState\PlatformPortalBundle\DigitalStatePlatformPortalBundle" --tag="views"
Customize resources/views/portal/index.html.twig.
PortalController for custom logic:
namespace App\Http\Controllers;
use DigitalState\PlatformPortalBundle\Controller\PortalController as BasePortalController;
class PortalController extends BasePortalController
{
public function customAction()
{
return $this->render('portal/custom', [
'data' => $this->getCustomData(),
]);
}
}
PortalService) via constructor:
public function __construct(private PortalService $portalService) {}
base.html.twig (published to resources/views/portal/layouts/).{% block content %}
{{ dump(data) }} {# Debug passed variables #}
{% endblock %}
portal/_header.html.twig).config/platform_portal.php:
'routes' => [
'home' => [
'path' => '/home',
'controller' => 'App\Http\Controllers\PortalController@home',
],
],
Route::get('/portal/{portal}', [PortalController::class, 'show']);
php artisan vendor:publish --tag="public"
Customize CSS/JS in public/vendor/platform-portal/.?v={{ config('app.version') }} to static assets for cache busting.PortalService:
namespace App\Services;
use DigitalState\PlatformPortalBundle\Services\PortalService as BasePortalService;
class PortalService extends BasePortalService
{
public function getExtendedData()
{
return $this->client->get('/api/extended');
}
}
AppServiceProvider:
$this->app->bind(
\DigitalState\PlatformPortalBundle\Services\PortalService::class,
\App\Services\PortalService::class
);
Configuration Overrides
php artisan config:clear after modifying config/platform_portal.php.Twig Autoloading
resources/views/portal/.views_path in config/platform_portal.php matches your structure.Route Conflicts
config/platform_portal.php:
'prefix' => 'portal',
Asset Paths
mix() helper.Service Binding
PortalService not injected due to incorrect binding.AppServiceProvider (see Implementation Patterns).'debug' => true in config/platform_portal.php to log service calls.{% debug %} to Twig templates for variable inspection.php artisan route:list to verify bundle routes are registered.Custom Controllers
PortalController (e.g., index(), show()).Event Listeners
PortalEvent (if the bundle emits them):
public function handle(PortalEvent $event)
{
// Custom logic
}
Middleware
Route::middleware(['portal.middleware'])->group(function () {
// Portal routes
});
Database Integration
Portal model (if it uses Eloquent):
namespace App\Models;
use DigitalState\PlatformPortalBundle\Models\Portal as BasePortal;
class Portal extends BasePortal
{
protected $customAttribute = 'value';
}
PortalService:
$data = Cache::remember('portal_data', now()->addHours(1), function () {
return $this->client->get('/api/data');
});
defer in Twig:
<script src="{{ asset('js/portal.js') }}" defer></script>
How can I help you explore Laravel packages today?