Download the PHP package petrelli/live-statics without Composer

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

About Live-Statics

Build Status

The petrelli\live-statics package provides a quick way to generate and integrate fake prototypes into our system. Mocked objects can easily be model to behave as the real ones, so you won't have to spend any time with integration tasks.

Both real and mocked data sources will live together so you will be able you to switch between them at any time by simply changing the subdomain.

A great secondary effect is that because our fake objects behave as real, a fully functional 'live static' version of your web application will be accessible to explore and click around.

Faker content can be parametrized, so your 'live statics' will change by just passing some URL parameters. This will come incredibly handy to perform visual QA, client presentations, and simply just to have a glance on how your site will behave with different types of content.

Quick demo

Let's explore a few links:

  1. Open. A real personal website.
  2. Open. Same URL with a static subdomain.

Notice the Projects list. It's just a simple loop within an Eloquent model collection.

The second link, is also a collection, but instead of Eloquent it's using our mocked models. Views and controller are the same for both URL's.

Install

  1. Include the package

You can run the command:

Or directly add it to your composer.json

And run composer update.

  1. If you have Package Auto-discovery (Laravel 5.5+ by default) skip to step 3, otherwise you'll have to manually add the service provider to your config/app.php file.

  2. Publish configuration files and the Service Provider

Usage

Create a new mocked class, and it's interface

  1. Generate a new Mocked class (e.g. Project). Run the command:

This will use the configuration values inside config/live-statics.php to generate a base mocked class Project, plus an interface ProjectInterface that will allow you to bind it to the real or fake implementation.

  1. Add binding instructions to config/live-statics.php

Convention is the following:

This will be enough to use your interfaces to inject them properly!

If your real class is not ready yet and you just want a quick prototype, pass null as the second element of the array.

Once you have your Mocked classes, remember to implement the interface in the real one.

Following our project example:

Using your newly created mocked elements

Let's use a controller as an example:

Here we inject ProjectInterface to the controller. This will bind the real, or mocked implementation depending on the subdomain.

If you are not confortable injecting dependencies as formal parameters you can use Laravels app function:

That's it!

You can change this subdomain modifying the subdomain option inside config/live-statics.php.

Shortcut for Eloquent models

This is a special case of a general class.

The package will provide a quick way for you to bind models, as most applications will be mainly mocking Eloquent models.

  1. Generate the mocked model

  2. Add binding instructions to config/live-statics.php

Notice instead of mocked_classes, we use mocked_models, and just pass the model's name.

The package will use path configurations for models provided on config/live-statics.php to bind them properly.

Add a custom namespace when creating new mocked classes or models

Keep your code organized creating namespaces for your mocked elements. Folders will be generated automatically.

This can be easily done passing by a second parameter to both commands:

When creating models, the namespace specified within config/live-statics.php will be added automatically.

Extra functionalities

Docs to be completed.

Dynamic parameters

Docs to be completed.

Namespaces and directories configuration

Docs to be completed.

Extending Faker through providers

Docs to be completed.

Creating different versions of your mocked classes

Docs to be completed.

Modifying your statics in real time through URL parameters

Docs to be completed.

Partial mocking

Docs to be completed.

License

The MIT License (MIT). Please see License File for more information.


All versions of live-statics with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
laravel/framework Version ~5.6|~5.7|~5.8|^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 petrelli/live-statics contains the following files

Loading the files please wait ....