Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Redirect Manager Bundle Laravel Package

astina/redirect-manager-bundle

View on GitHub
Deep Wiki
Context7

Astina Redirect Manager Bundle

Build Status Latest Stable Version Total Downloads SensioLabsInsight

Install

Step 1: Add to composer.json

"require" :  {
    // ...
    "astina/redirect-manager-bundle":"dev-master",
}

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Astina\Bundle\RedirectManagerBundle\AstinaRedirectManagerBundle(),
    );
}

Step 3: Import routing file

Import routing file of bundle. Change prefix attribute to suit your needs.

In YAML:

# app/config/routing.yml
astina_redirect_manager:
    resource: "@AstinaRedirectManagerBundle/Resources/config/routing.yml"
    prefix:   /redirect/

Step 4: Translations

If you wish to use default texts provided in this bundle, you have to make sure you have translator enabled in your config.

# app/config/config.yml

framework:
    translator: ~

Step 5: Configuration Options

In an application with multiple entity managers please configure a new manager or ensure the default manager can access the schema.

# app/config/config.yml
astina_redirect_manager:
    storage:
      entity_manager: redirect # Optional entity manager name, if ommitted default entity manager is used
    base_layout: "SomeBundle:SomeDir:index.html.twig"    # Override default Astina layout
    enable_listeners: false # Set to false to disable redirect listeners. Useful for service oriented architectures. Defaults to true

Step 6: Update your DB schema

$ php app/console doctrine:schema:update --force

Usage

Importing urls with command

Bundle knows how to import csv file of url for redirection. CSV has to contain two columns, where the first one contain urlFrom and second urlTo.

$ php app/console armb:import /path/to/csv/file.csv [--redirect-code=302] [--count-redirects]

Using subDomain listener to redirect to somewhere else

If listener detects that subDomain is used it redirects visitor to url with name route_name with route_params and redirect code redirect_code.

# app/config/config.yml

astina_redirect_manager:
    redirect_subdomains:
        route_name:           ~ # Required
        route_params:
            param1: some-value
            param2: some-different-value
        redirect_code:        301

Warning

You have to set parameter router.request_context.host in parameters.yml file. Otherwise value localhost will be used as domain name.

# app/config/parameters.yml

# ...
router.request_context.host: example.com
# ...
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui