npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

express-phpify

v1.2.6

Published

Express, (literally) Redefined.

Downloads

46

Readme

express-phpify

Express, (literally) Redefined.
NOW WITH OPTIONS

Getting Started

Installing

Install this package to run following command.

npm install express-phpify // or else you can use `yarn add express-phpify`.

And just add below code to your app (if you don't need to configure something).

// `app` is your existing express application.
phpify(app);

OR use the options to match your needs! (v.1.1.0 or higher)

// `app` is your existing express application.
phpify(app, {
  // (Optional) What should it set the header value X-Powered-By to? default: PHP/5.3.3, set false to disable
  headerXPoweredBy: 'PHP/5.3.3',
  // (Optional) What should it set the header value server to? default: Apache/2.2.27 (Unix), set false to disable
  headerServer: 'Apache/2.2.27 (Unix)',
  // Should it fake PHPSESSID? This is default, set false to disable
  // Legacy Codes will be compatible at this point, but i recommend using this way.
  fakePHPSESSID: {
    // maxAge of fake session Cookie in milliseconds, (default: 5 minutes)
    maxAge: 300000,
    // Instead of PHPSESSID, Which fake session name you are going to use? (default: PHPSESSID)
    sessionName: "PHPSESSID",
    // Where should be the basePath of the cookie? (default: /)
    basePath: "/"
  },
  // Redirection setup. This is the default, set false to disable 
  redirection: {
    // add .php at end of the file, e.g. /a -> /a.php, default: true
    file: true,
    // should we redirect directory? set false to disable
    directory: {
      // (Optional) set the indexFileName e.g. /a/ -> /a/index.php
      indexFileName: 'index.php'
    }
  },
  // Mock the eastereggs at PHP. (available from 1.2.3-beta)  
  // This will read the version info of PHP from headerXPoweredBy (if not set, 5.3.3 will be used.)
  // This will not work if your headerXPoweredBy's version is setted over 5.5.0 (since PHP removed it) (Default: true)
  phpEastereggs: true
})

Phpifying existing application

Before you run actual application's codes, Please run phpify(app); (Suppose app as express application) beforehand.
phpifying can not procede, if you use phpify after the application logic. (responses are already sent)

READ THIS!!

This library will only allow accessing to paths that end with / or with .php extension by default,
If you don't want it, Set the option redirection to false (default: true)

Built With

  • Express - The web framework used
  • TypeScript - The Best language on NodeJS
  • PHP - The BADDEST language ever

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Why do you need this project?
  • Inspired by this tweet(Korean), (Github profile)
  • This library IS NOT guaranteed to be recognized as PHP.
  • If this library does not correctly mock the express to PHP, and if you know how to fix it in the source code, Feel free to give us a PR. It always will be welcomed.

TODO

  1. Force .php extension to every routes. (DONE)
  2. stacktraces everywhere, just like PHP does.
  3. create user response to easteregg (DONE)