Download the PHP package silverstripe/environmentcheck without Composer

On this page you can find all versions of the php package silverstripe/environmentcheck. 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 environmentcheck

Silverstripe Environment Checker Module

CI Silverstripe supported module

This module adds an API for running environment checks to your API.

Aren't these just unit tests?

Almost, but not really. Environment checks differ from unit tests in two important ways:

Installation

Activating Directly

Register checks in your own _config.php - see the _config.php in this module for some defaults. Don't forget to either use a fully-qualified (namespaced) class name for EnvironmentCheckSuite, or use (import) the namespaced class first.

Activating Via Config

Register your checks on the EnvironmentCheckSuite. The same named check may be used multiple times.

You can also disable checks configured this way. This is handy if you want to override a check imposed on your project by some other module. Just set the "state" property of the check to "disabled" like this:

Available checks

Monitoring Checks

Checks will return an appropriate HTTP status code, so are easy to hook into common uptime montoring solutions like pingdom.com.

You can also have the environment checker email results with the following configuration:

Errors can be logged via the standard Silverstripe PSR-3 compatible logging. Each check will cause an individual log entry. You can choose to enable logging separately for warnings and errors, identified through the result of EnvironmentCheck->check().

Authentication

By default, accessing the dev/check URL will not require authentication on CLI and dev environments, but if you're trying to access it on a live or test environment, it will respond with a 403 HTTP status unless you're logged in as an administrator on the site.

You may wish to have an automated service check dev/check periodically, but not want to open it up for public access. You can enable basic authentication by defining the following in your environment (.env file):

Now if you access dev/check in a browser it will pop up a basic auth popup, and if the submitted username and password match the ones defined the username and password defined in the environment, access will be granted to the page.

Adding more checks

To add more checks, you should put additional EnvironmentCheckSuite::register calls into your _config.php. See the _config.php file of this module for examples.

The first argument is the name of the check suite. There are two built-in check suites, "health", and "check", corresponding to the health/check and dev/check URLs. If you wish, you can create your own check suites and execute them on other URLs. You can also add a check to more than one suite by passing the first argument as an array.

To test your own application, you probably want to write custom checks:

Here is a simple example of how you might create a check to test your own code. In this example, we are checking that an instance of the MyGateway class will return "foo" when call() is called on it. Testing interfaces with 3rd party systems is a common use case for custom environment checks.

Once you have created your custom check class, don't forget to register it in a check suite

Using other environment check suites

If you want to use the same UI as health/check and dev/check, you can create an EnvironmentChecker object. This class is a RequestHandler and so can be returned from an action handler. The first argument to the EnvironmentChecker constructor is the suite name. For example:

If you wish to embed an environment check suite in another, you can use the following call:

$result will contain a EnvironmentCheckSuiteResult object

See EnvironmentChecker.ss to see how these can be used to build a UI.

Versioning

This library follows Semver. According to Semver, you will be able to upgrade to any minor or patch version of this library without any breaking changes to the public API. Semver also requires that we clearly define the public API for this library.

All methods, with public visibility, are part of the public API. All other methods are not part of the public API. Where possible, we'll try to keep protected methods backwards-compatible in minor/patch versions, but if you're overriding methods then please test your work before upgrading.

Reporting Issues

Please create an issue for any bugs you've found, or features you're missing.


All versions of environmentcheck with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
silverstripe/framework Version ^5
silverstripe/versioned Version ^2
guzzlehttp/guzzle Version ^7
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 silverstripe/environmentcheck contains the following files

Loading the files please wait ....