Download the PHP package timacdonald/log-fake without Composer

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

Log fake for Laravel

A bunch of Laravel facades / services are able to be faked, such as the Dispatcher with Bus::fake(), to help with testing and assertions. This package gives you the ability to fake the logger in your app, and includes the ability to make assertions against channels, stacks, and a whole bunch more.

Installation

You can install using composer:

Basic usage

Channels

If you are logging to a specific channel (i.e. not the default channel) in your app, you need to also prefix your assertions in the same manner.

Stacks

If you are logging to a stack in your app, like with channels, you will need to prefix your assertions. Note that the order of the stack does not matter.

That's it really. Now let's dig into the available assertions to improve your experience testing your applications logging.

Available assertions

Remember that all assertions are relative to the channel or stack as shown above.

assertLogged()

Assert that a log was created.

Can be called on

Example tests

assertLoggedTimes()

Assert that a log was created a specific number of times.

Can be called on

Example tests

assertNotLogged()

Assert that a log was never created.

Can be called on

Example tests

assertNothingLogged()

Assert that no logs were created.

Can be called on

Example tests

assertWasForgotten()

Assert that the channel was forgotten at least one time.

Can be called on

Example tests

assertWasForgottenTimes()

Assert that the channel was forgotten a specific number of times.

Can be called on

Example tests

assertWasNotForgotten()

Assert that the channel was not forgotten.

Can be called on

Example tests

assertChannelIsCurrentlyForgotten()

Assert that a channel is currently forgotten. This is distinct from asserting that a channel was forgotten.

Can be called on

Example tests

assertCurrentContext()

Assert that the channel currently has the specified context. It is possible to provide the expected context as an array or alternatively you can provide a truth-test closure to check the current context.

Can be called on

Example tests

assertHasSharedContext()

Assert that the Log manager currently has the given shared context. It is possible to provide the expected context as an array or alternatively you can provide a truth-test closure to check the current context.

Can be called on

Example tests

Inspection

Sometimes when debugging tests it's useful to be able to take a peek at the messages that have been logged. There are a couple of helpers to assist with this.

dump()

Dumps all the logs in the channel. You can also pass a truth-based closure to filter the logs that are dumped.

Can be called on

dd()

The same as dump, but also ends the execution.

dumpAll()

Dumps the logs for all channels. Also accepts a truth-test closure to filter any logs.

Can be called on

Example usage

ddAll()

The same as dumpAll(), but also ends the execution.

Other APIs

logs()

Get a collection of all log entries from a channel or stack.

Can be called on

Example usage

allLogs()

Similar to logs(), except that it is called on the Facade base and returns a collection of logs from all the channels and stacks.

Can be called on

Example usage

Credits

And a special (vegi) thanks to Caneco for the logo ✨

Thanksware

You are free to use this package, but I ask that you reach out to someone (not me) who has previously, or is currently, maintaining or contributing to an open source library you are using in your project and thank them for their work. Consider your entire tech stack: packages, frameworks, languages, databases, operating systems, frontend, backend, etc.


All versions of log-fake with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/collections Version ^10.0 || ^11.0
illuminate/contracts Version ^10.0 || ^11.0
illuminate/log Version ^10.0 || ^11.0
illuminate/support Version ^10.0 || ^11.0
phpunit/phpunit Version ^10.0 || ^11.0
psr/log Version ^1.0 || ^2.0 || ^3.0
symfony/var-dumper Version ^6.0 || ^7.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 timacdonald/log-fake contains the following files

Loading the files please wait ....