Download the PHP package soflomo/prototype without Composer

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

Soflomo\Prototype

Soflomo\Prototype is a small module that helps developers to start creating prototypes of their application. The module aims to create various pages fast and only worry about urls and view templates. Because of its simple goals, frontend developers not experienced with php can create mockups of their designs as well.

Simply said, it allows you to create a mapping between urls and view templates, so websites with a couple of pages are extremely easy to create. Every page has a name, so it is possible to link between pages with the Zend Framework 2 url() view helper.

Installation

Soflomo\Prototype is available through composer. Add "soflomo/prototype" to your composer.json list. During development of Soflomo\Prototype, you can specify the latest available version:

Enable the module in your config/application.config.php file. Add an entry Soflomo\Prototype to the list of enabled modules.

Usage

The recommended method is to create a module to hold all the mockup view scripts and the configuration of pages. For example, you call this module Mockups.

Create mockup module

Create a directory Mockup inside the module directory. Create a file Module.php inside this module/Mockup directory with the following contents:

Then create a folder module/Mockup/config. Create a file module.config.php inside this module/Mockup/config directory with the following contents:

As a last step, create the directory view inside module/Mockup. This should be enough to get you started for this module.

Enable Mockup module

Locate the file config/application.config.php and put the Mockup module at the end of the list of modules to be enabled. NB. Make sure you also enabled the Soflomo\Prototype module, as described above under "Installation".

Create the pages

The last step is your mockup page configuration. Get back to the module.config.php file in the Mockup module. Inside the soflomo_prototype array, you create (as an example) two pages:

Now you have two pages, one called homepage which is loaded when you load the application / (e.g. http://mysite.localhost/) and the other is called hello and is loaded when you load /hello-world (e.g. http://mysite.localhost/hello-world).

For both pages you need to create a template to be loaded. Inside the module/Mockup/view directory you create a new one mockup and inside it, you create a file homepage.phtml and another hello-world.phtml. Those will be rendered for respectively the homepage and the hello page.

If you need to create a link from one page to another, just use the url() view helper. An example to link to the hello page on the homepage, put this in your homepage.phtml:

This will render a link like this:

Parametrized routes

Soflomo\Prototype supports route parameters with the segment type route in Zend Framework 2. This means you could have a route like /foo/bar/:id. By default, the module only uses literal routes to match the exact url. This is faster, but less flexible. You can specify to have the segment type by an additional type key:

These routes types are extremely useful when dealing with existing applications. If you have an application where you deal with parametrized routes, you want to have a parametrized route for your mockup page as well. This way, you could always navigate back to your real application when a user vists the mocked page.

Why?

You might ask why we built this module and did not use a micro framework like Silex. Or, why we do not start in Zend Framework 2 directly.

To answer the first, micro frameworks are hard to combine with existing Zend Framework 2 applications. We (at Soflomo) need a way to create prototypes also for existing applications. If we prototype a new design for a new module, the existing site with existing designs and existing modules should be kept intact.

However, "normal" Zend Framework 2 configuration is quite some work if you only want to connect routes with view scripts. Frontend developers can easily copy/paste above code for a new module and they are up and running. It simply costs too much time and effort to use the existing nested routes, create controllers, actions, make them loadable via configuration, fetch the view template from the route match options and return a correctly configured view model. For fast protyping, you now just add four lines for a page name, route and view script and it Just Works (tm).

Development

Soflomo\Prototype is intended to create prototypes really fast, but this module is by no means intended for production usage. It is (at this moment) not tested, not stable and there are no guarantees it is bug-free. Use at your own risk!

If you want to join development or found any bug, feel free to fork this project and make your adjustments. Create a pull request to ask for the changes to be merged back in Soflomo\Prototype. If you have any questions about this module, feel free to contact us at [email protected].


All versions of prototype with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3.
zendframework/zendframework Version 2.*
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 soflomo/prototype contains the following files

Loading the files please wait ....