src/Tomahawk/Routing/Router.php
public function group($options, \Closure $callback)
    {
        $prefix = null;

        if ( ! (is_string($options) || is_array($options))) {
            throw new \RuntimeException('Options must either be a string or array');
        }

        if (is_string($options)) {
            $prefix = $options;
            $options = [];
        }
        else if (is_array($options) && isset($options['prefix'])) {
            $prefix = $options['prefix'];
        }

        $subCollection = new RouteCollection();

        $subRouter = new self();
        $subRouter
            ->setInGroup(true)
            ->setRoutes($subCollection);

        $callback($subRouter, $subCollection);

        if ($prefix) {
            $subCollection->addPrefix($prefix);
        }

        if ($options) {
            if (isset($options['domain'])) {
                $subCollection->setHost($options['domain']);
            }

            if (isset($options['schemes'])) {
                $subCollection->setSchemes($options['schemes']);
            }

            if (isset($options['methods'])) {
                $subCollection->setMethods($options['methods']);
            }

            if (isset($options['defaults'])) {
                $subCollection->addDefaults($options['defaults']);
            }

            if (isset($options['options'])) {
                $subCollection->addOptions($options['options']);
            }

            if (isset($options['requirements'])) {
                $subCollection->addRequirements($options['requirements']);
            }
        }

        $this->getRoutes()->addCollection($subCollection);

        return $this;
    }
public function group($options, \Closure $callback)
    {
        $prefix = null;

        if ( ! (is_string($options) || is_array($options))) {
            throw new \RuntimeException('Options must either be a string or array');
        }

        if (is_string($options)) {
            $prefix = $options;
            $options = [];
        }
        else if (is_array($options) && isset($options['prefix'])) {
            $prefix = $options['prefix'];
        }

        $subCollection = new RouteCollection();

        $subRouter = new self();
        $subRouter
            ->setInGroup(true)
            ->setRoutes($subCollection);

        $callback($subRouter, $subCollection);

        if ($prefix) {
            $subCollection->addPrefix($prefix);
        }

        if ($options) {
            if (isset($options['domain'])) {
                $subCollection->setHost($options['domain']);
            }

            if (isset($options['schemes'])) {
                $subCollection->setSchemes($options['schemes']);
            }

            if (isset($options['methods'])) {
                $subCollection->setMethods($options['methods']);
            }

            if (isset($options['defaults'])) {
                $subCollection->addDefaults($options['defaults']);
            }

            if (isset($options['options'])) {
                $subCollection->addOptions($options['options']);
            }

            if (isset($options['requirements'])) {
                $subCollection->addRequirements($options['requirements']);
            }
        }

        $this->getRoutes()->addCollection($subCollection);

        return $this;
    }
Create a route group

@param string|array $options
@param \Closure $callback
@return $this