pollus/view

View layer for pollus/mvc

dev-master 2019-08-27 03:56 UTC

This package is auto-updated.

Last update: 2019-12-27 04:54:01 UTC


README

Warning: This package is under heavy development, contains broken code and is far from production ready, be advised!

View layer for pollus/mvc.

In Pollus, the "view layer" is splitted in 3 parts:

  • View Data: These objects should be returned from a pollus/controller instance in order to be used within a View Engine, they don't provide any rendering logic, only data, the response object and some adittional settings. They can contain some internal logic to manipulate their properties, but they aren't aware about any View Engine. These objects should implement the ViewDataInterface. The default View Data implementation is called simply as "View".

  • View Engine: These objects contain all the rendering logic and they know their View Data objects and what to expect from them, they can thrown exceptions if the provided information is incorrect. It's intented to be used as wrapper for Template Engines, that's why is called View Engine. They should implement the ViewEngineInterface. Although this package comes with an default implementation to View Data, it doesn't provide any View Engine by default.

  • View Handler: A single class contained in this package that binds the View Data to it's View Engine, this object will receive the return from pollus/controller and forward to the right View Engine, or thrown an exception if not registered. If a response object is returned from controller, the View Handler will do nothing.

As stated before, this package doesn't provide any View Engine, but you can choose one from bellow (coming soon) or implement your own.

Install

composer require pollus/view

Examples Coming soon..

MIT License

Copyright (c) 2019 Renan Cavalieri

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.