Download the PHP package davewid/owl without Composer

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

Owl

Owl is a view library that can interface with different template rendering engines. Owl uses Mustache as the default rendering engine. Requires PHP 5.3+.

Installing

As of version 1.2.x you can now use Composer to install the Owl library. Owl is hosted on Packagist so all you will need to add to the require section of composer.json file is below.

Alternatively you can visit the downloads page and click on the latest version to grab the files. If you download the files from github you will need to setup autoloading by hand.

PHP-FIG

Owl is in compliance with PSR-0 and PSR-1

Setup

The Owl library strives for flexibility in rendering engines and finding files. Unfortunately this flexibility adds a few more steps in the setup process. Below are the two things you can inject, the rendering engine and the file finder.

Engine

By default, a Mustache rendering engine is setup. If you would like to use a different engine you can set it with setEngine. Your engine will have to implement the \Owl\Engine interface. The rendering engine is shared between any view and layout classes you use in a request, so you only need to set the engine once per request.

File Finder

We need a way to find the template files to load and then eventually render. You will need to specify a class that implements \Owl\Finder to do that. Provided are a direct file system class and if you are using the Kohana framework, a finder that uses the cascading file system (Badass!).

Usage

Now that you are setup, lets start creating your view classes and building your application!

The first thing you will want to do is create a new class that extends \Owl\View.

Along with the view class you will need the mustache template. The template files are loaded automatically from the template directory, based on the class name. All underscores and namespace separators in the class name are converted to directory separators. If you want to specify the full path to your files manually, override the getFile function.

In our example above, we will want to create our template at __DIR__/views/Homepage.mustache.

Then all we will need to do is render our view class (echo works also).

Layout

The Owl library also comes with a layout class that can help you build reusable layout files. Let's take a quick look at an example.

Our template file at __DIR__/views/Layout/Browser.mustache would then hold our html page.

This is great, but where it gets really dynamic is being able to add content into the layout.

Adding Content To a Layout

First we will need to modify our layout template file to have a content partial.

Then we can pass in either an \Owl\View class or raw html into the layout.

When the layout is rendered, it will replace the content partial {{> content}} with the content you passed into the layout, which in our example is the Homepage view.

{{> content}} would then be replaced with Hello Dave. This lets you have a reusable layout and change the page content based on the page. Pretty cool huh?

Added To Layout

One last thing you should know about is the addedToLayout function.

When a class that extends \Owl\View is passed into a layout class, the addedToLayout function is called and the current layout is passed in as the only argument.

This is powerful because now you can use this function to add things to the layout.

Say you wanted to add some more js or css files because the specific page is a little more dynamic or styled differently, you would do it in the addedToLayout function.

For a quick example, I will add the title from the view class onto the layout title.

Now we the layout is rendered the title tag will render out as so.

<title>My Page &raquo; Welcome</title>

Flash Messages

The Owl library provides a Message class so you can pass messages between requests in your application

Setup

Before you can use the Message class you will need to supply a session driver that implements \Owl\Session. If you are using the Kohana framework, a wrapper class for the internal Session class has been provided at \Owl\Session\Kohana.

Once you have your session driver you will need to inject it into the class.

Now the library is ready to go!

Getting Messages

To get a message all you need to do is run get:

If no message is found this function will return false.

Setting Messages

To set a flash message all it takes is the following:

Properties

Name type Description
type string The type of message (this can be anything)
message mixed The message you want to pass along. This can be anything, but a string or array of strings will probably work best

Wrapper methods

There are also methods that are wrappers for the different types of messages.

Exploration

There is more to explore in the Owl library, but I'll leave that to you. If you have any questions/bugs/concerns please use the bug tracker here on github.

Hacking

If you use a different framework than those currently supported fork this repo and add those files. The only thing I ask is to please use and send pull requests on the develop branch.

License

This code is licensed under the MIT license.


Developed by Dave Widmer.


All versions of owl with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
mustache/mustache Version 2.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 davewid/owl contains the following files

Loading the files please wait ....