Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to force usage of router file #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bcole808
Copy link

The Problem

I needed to be able to have all server requests to the php built in server utilize my custom router.php file. This extension has a built in router which sometimes sends requests straight to the servers document root and sometimes sends requests to the specified router.php file.

The Fix

I added an option to allow the developer to configure this extension to always send requests to the specified router file, regardless of the contents of document root.

Works like this:

    config:
        Codeception\Extension\PhpBuiltinServer:
            hostname: localhost
            port: 9000
            documentRoot: src
            startDelay: 1
            router: my_router.php
            alwaysUseRouter: true

@tiger-seo
Copy link
Owner

        if (file_exists($filePath) && is_file($filePath)) {
            return false; // serve the requested resource as-is.
        } elseif ($userRouter) {
            return $userRouter;
        }

the reason why router is not used is because the requested resource is exists

@bcole808
Copy link
Author

Yes, I understand that is why the router is only used for some requests. My issue is that I need all requests to go to the router, even if the resource exists in the document root directory.

@tiger-seo tiger-seo force-pushed the master branch 3 times, most recently from 794932d to e0509bb Compare December 20, 2016 01:05
@tiger-seo tiger-seo force-pushed the master branch 3 times, most recently from ae1ad2e to a79b3e4 Compare December 3, 2017 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants