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

Simple routing script for built-in php server #1395

Open
wants to merge 6 commits into
base: next
Choose a base branch
from

Conversation

Raruto
Copy link
Contributor

@Raruto Raruto commented Jan 20, 2021

The actual script has some limitations due to the built-in php server implementation:

php -S localhost:8080 index.php

(eg. opening http://localhost:8080/install causes a 404 error or similar)


For those interested in learning more check out:

  • drupal's .ht.router.php (from which I took inspiration for the name)
  • cockpit's .htaccess for any other missing rules (eg. "deny" rules)
  • official documentation about the built-in server

Have a nice Day,
Raruto

@aheinze
Copy link
Member

aheinze commented Jan 22, 2021

Thanks for the contribution! I'll try to test this soon!

@Raruto
Copy link
Contributor Author

Raruto commented Feb 25, 2021

@aheinze now it works pretty much the same as the htaccess file (refer to #1404 for the section comments).

For convenience I have also added the following composer script:

composer run dev

composer.json:

    "scripts": {
        "dev": [
            "Composer\\Config::disableProcessTimeout",
            "php -r \"exec((['Darwin'=>'open', 'WINNT'=>'explorer'][PHP_OS] ?? 'xdg-open').' '.escapeshellarg('http://localhost:8080'));\"",
            "php -S localhost:8080 index.php"
        ]
    },

Essentially, it starts the development server and opens a new browser tab at the following address localhost:8080

Have a nice Day,
Raruto

@Raruto
Copy link
Contributor Author

Raruto commented Oct 31, 2021

Hi @aheinze, just to know, are there any news on this?

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.

None yet

2 participants