Download the PHP package benconstable/phpspec-laravel without Composer

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

phpspec Laravel Extension

phpspec extension for testing Laravel applications.

Build Status Latest Stable Version Total Downloads License

Versions

Depending on the version of Laravel and/or Phpspec you're using, you'll want to make sure that you're using the version of this package that's right for you. Use the table below to pick the right one.

PHP Version Package Version Laravel Version Phpspec Version
>=5.3.0 ^v1.2 ^v4.1 ^v2.0
>=5.4.0 ^v2.0 v5.0-v5.3 ^v2.1
>=5.6.0 ^v3.0 ^v5.1-v5.4 ^v3.0
>=7.0.0 ^v4.0 ^v5.4 ^v4.0

Installation

Install the package with composer:

then add this to your phpspec.yml:

You can take a look at example.phpspec.yml for a good set of sensible phpspec defaults for a Laravel project.

Why this extension?

This extension provides you with a bootstrapped Laravel environment when writing your phpspec tests.

It allows you to make use of some of the nice features that Laravel provides, like class aliases and helper functions, without being hindered by your testing framework.

This extension is not a swap-in replacement for Laravel's built in PHPUnit setup. If you'd like integration and/or functional tests, please use that, Behat, or Codeception.

Configuration

Testing environment

By default, the extension bootstraps Laravel in the testing environment. You can change this to production (or whatever you like) by setting:

in your phpspec.yml.

App bootstrap path

By default, the extension will bootstrap your app by looking for bootstrap/app.php in the directory above vendor/. This is the default location that Laravel provides.

You can manually specify the path to the bootstrap file if you're using a non-standard installation, like so:

You can specify either an absolute path (use leading slash), or a path relative to the vendor/ directory.

Usage

Testing without Laravel

If you're not using any code specific to the Laravel environment, then you don't need to do anything differently. Just write your phpspec tests as normal!

Testing with Laravel

If you want to take advantage of Laravel's aliases, or use some of its helper functions, extend your specs from PhpSpec\Laravel\LaravelObjectBehavior. This will prevent errors when testing.

For example, this class uses an alias:

and without extending from PhpSpec\Laravel\LaravelObjectBehavior:

you'll get Fatal error: Class 'Inspiring' not found.... But extending from PhpSpec\Laravel\LaravelObjectBehavior:

you'll get ✔ inspires backwards.

and this class uses a helper function:

and without extending from PhpSpec\Laravel\LaravelObjectBehavior:

you'll get Fatal error: Call to a member function make() on a non-object.... But extending from PhpSpec\Laravel\LaravelObjectBehavior:

you'll get ✔ encrypts a string.

Accessing the IoC container

If you need to access the Service Container in your specs, just use the app() helper!

Learning more about phpspec and Laravel

Laracasts has some great guides on phpspec and Laravel. 'Laravel, phpspec and refactoring' is a good starting point; it shows how you should use phpspec with Laravel, and covers the basics of writing tests (and it's free!).

Contributing

See CONTRIBUTING.md.

License

MIT © Ben Constable. See LICENSE for more info.

Thanks

Thanks to...


All versions of phpspec-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
phpspec/phpspec Version ^4.0
laravel/framework Version ^5.4
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 benconstable/phpspec-laravel contains the following files

Loading the files please wait ....