Download the PHP package giberti/phpunit-local-server without Composer

On this page you can find all versions of the php package giberti/phpunit-local-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpunit-local-server

PHPUnit Local Server

Build and Test

Provides an HTTP server test case for PHPUnit. The server is powered by PHP's built-in server for testing of network related calls.

Installing

This library requires PHP 7.3 or newer, including PHP 8.0, 8,1, and 8.2. It will run with PHPUnit versions 8 and 9.

Usage

Usage Tips

A single test

Call either the createServerWithDocroot() or createServerWithRouter() helper method and then execute your test.

Several tests using the same configuration

To optimize performance of your tests, it's best to re-use the server whenever possible. To make this easier, simply start the server at the beginning of the class by defining a setupBeforeClass() method with your desired configuration.

Modifying the server runtime version

It's possible to run the server under a different PHP runtime than the version running your test suite. This can help with testing your code under multiple versions of PHP. In the example below, the server will start with the PHP 7.3 and 8.1 executable in /usr/local/bin/ on the host test system. Your path may be different.

Methods

The following methods are provided to interact with the local server.

public bool LocalServerTestCase::createServerWithDocroot(string $docroot)

Creates a local server using a document root.

public bool LocalServerTestCase::createServerWithRouter(string $router)

Creates a local server using a router file. If you are using a framework, this is most likely the index.php file in your document route.

public void LocalServerTestCase::destroyServer(void)

Removes the local server. Useful to reset the session state. This is automatically called in the tearDownAfterClass() lifecycle method.

public string LocalServerTestCase::getServerUrl(void)

The port for the server will usually be 8000, however, it is dynamically assigned in the event of a conflict. The safest way to access the host is to call the getServerUrl() method and use that as the root for any Url construction.


All versions of phpunit-local-server with dependencies

PHP Build Version
Package Version
Requires ext-posix Version *
php Version ^7.3 || ^8.0
phpunit/phpunit Version ^8.0 || ^9.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package giberti/phpunit-local-server contains the following files

Loading the files please wait ....