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

php-env-server

v2.0.3

Published

Initialize a PHP server.

Downloads

16

Readme

php-env-server

Use a PHP's built-in development web server.

Don't use for production!!

Still in development.

Only tested on Windows 10 x64

Features

  • PHP's built-in
  • Available operating systems:
    • win32: Windows
  • Available PHP versions:
    • win32 (Windows)
      • 7.3.10
      • 8.2.7
  • Easy way of using it

Install

npm install php-env-server

Usage

(async () => {
    // VARIABLES
    const { server } = require("php-env-server");
    const php = await server({});

    // ... code
})();

By default, the server is configured to run under the following specifications:

  • host - localhost.
  • port - 3000.
  • root - public.
  • target - system.

If the system doesn't match with the above configuration the server will throw an error.

Ofcourse you can change these and other options as indicated below.

API

server({...options?})

Returns an object with the following properties:

  • url - The URL to the server.
  • stop() - A function to stop the server.
hostname

Type: string Default: localhost

The hostname the server will use.

port

Type: number Default: 3000

The port used by the server.

root

Type: string Default: public

The directory the server will use as the main directory.

target

Type: string Default: "system"

The source which indicates where PHP will be used from.

By default, it's value is system, which means node will try to find PHP in your system to use that version and it's configuration.

It also accepts 2 more values:

  • module: When used, the version (PHP version) value is required.
  • custom: This means you can use your own configuration to specify which files the server will use to work properly.
Note:

The specified version when using module must be part of the module. Check Features section above.

version

Type: string Default: ""

This will work only using target as module. This is needed when using target as module.

Specify the PHP version to use.

Check Features section above to use the correct version available for your operating system.

directives

Type: object Default: {}

Define properties in the object to specify the server configuration the directives to use instead of the ones configured in php.ini.

When using module as target, by default this object is configured as follow:

{
    "session.save_path",
    "curl.cainfo"
}

These 2 properties have a default value pointing to the paths located in the module. You can overwrite them.

  • session.save_path: A folder to save PHP's session files created by a PHP script using session_start()
  • curl.cainfo: In case you use curl in PHP to access external urls, the path to this file will tell PHP which SSL to use.

Check List of php.ini directives for more information.

arguments

Type: array Default: []

This will work only using target as custom.

An array containing the arguments to use in PHP. If you want to use an argument, you must specify it's type first. Example:

  • ["-c", ".../php.ini"]: Where "-c" is the type which indicates that the following element of the array will be the path to php.ini.

Check Command line options for more information.

Note:

To use directives, use directives object as indicated above instead of using ["-d", "directive value"] to avoid any error.

php_cgi

Type: string Default: ""

This will work only using target as custom.

This have to be the path of the php-cgi file to execute PHP scripts.

env

Type: object Default: {}

Set environment variables for the PHP process.

Note:

Be REALLY careful when using env variables cause you can affect the correct functionality of PHP established by default by the module.

Check $_ENV for more information.