Download the PHP package nowise/uup-site without Composer
On this page you can find all versions of the php package nowise/uup-site. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package uup-site
UUP-SITE - Web application and site framework
This package is a micro framework that takes a object oriented approach at building large scale web sites and web applications in PHP. Designed with small memory footprint, easy of use and fast execution in mind.
Controllers are placed direct under public and derives from suitable base classes to define their behavior (i.e. being a public web page or a secured JSON service) and is also responsible for loading their views. The dispatcher takes care of natural routing from request path to controller.
If a public page don't contains a class, then its treated as a simple view by the dispatcher that takes care of wrapping it up inside a view controller before rendering it with decorations.
Quick start:
For those impatient to try this out without any further reading:
Create a symbolic link to public under your htdocs and point your favorite browser at /myapp should get you started:
Pretty simple, right?
Features:
Supports for multiple theme, rendering page content direct or using a dispatcher (routing) script and designed with these goals:
- Suitable for web interfaces, AJAX or services (i.e. API in JSON or SOAP)
- Responsive design with multiple themes
- Small memory footprint (~500kB per request)
- Fast request handling (less than 0.01 ms per request)
- Support for internationalization (I18N) and localization (L10N)
Site config:
The config/defaults.site file is looked for in the package directory (vendor/nowise/uup-site) or in the site directory (the virtual host directory). Support for auth and edit is disabled by default, enable them in config/defaults.site.
Setup (web sites):
The recommended solution is to use the uup-site.sh for setting up instances using uup-site. For installation thru composer its located under vendor/bin. When installing a virtual host, make sure that public is the only directory exposed to outside world.
To bootstrap and initialize a new virtual host:
Review content of the public and config directories once setup has finished. Decide upon if page routing (mod_rewrite) should be used or not. Complete the setup by defining the public directory as document root (if developing a web site).
See https://nowise.se/oss/uup/site/usage/setup/ for more setup alternatives, including bootstrap, composer, archive or manual.
Themes:
Themes are bundled under the theme directory and consists of public content and template files. During render phase, a matching theme and template (*.ui) file is looked for under the template directory.
Infrastructure:
Menus and publish information can either be defined by having custom files in the page directory or programmatically by redefining menu content in the page constructor.
See example/context for infrastructure example. See example/multi for example on programatically defined menus. The site config file has some influence on menu handling too.
See example/context/menus for more advanced menus, like dynamic update page content or defining menus relative current site root.
Controllers, dispatch and rendering:
A page class can be rendered either direct or using routing. Using dispatch routing is the recommended method that in addition supports views and provides pretty URL's.
Rendering (direct):
Rendering (dispatch):
More examples is included in example directory in the source package. It's recommended that your application derives your own controllers from the provided base classes to support JSON or file API.
Views:
While pages are complete classes, views are simple files that contains just the main section content (HTML/PHP fragments). Using routing is the recommended method for render views.
Using standard page class for rendering views makes the context (i.e. menus) available for decoration. Views are intended for web sites, while pages are more targeted at web application (more control).
Authentication:
Enable authetication by running uup-site.sh. The config/auth.inc file needs to be tweaked with supported authenticators.
You will need to enabled authentication settings inside config/defaults.site. An controller can enforce authentication by deriving from a secure base class. It's also possible to programmatically enforce authentication from within a public controller i.e. based on requested view.
Namespace:
The default dispatcher setup will not support namespaces in controllers. If you like to use namespace in them, the modify public/dispatch.php:
If your controller is i.e. located inside public/api/customer, then use the namespace API\Customer inside that controller. If you like to use application prefix in your namespace names, i.e MyApp\Controllers\API\Customer, then define your namespace as:
Locales and translation:
Enable locale (gettext) support using uup-site.sh:
This will create a locale directory and install a makefile in current directory. If the site/application is huge, then its recommended to use multiple text domains:
uup-site
├── htdocs/ // Document root
│ ├── dir1/
│ ├── dir2/
... ...
├── locale/ // Support for locale (gettext)
│ ├── dir1.pot
│ ├── dir2.pot
... ...
Each page can initialize its own text domain in the constructor:
Online content editor:
Enable CMS by running uup-site.sh. You need to install javascript libraries and tweak the edit settings inside config/defaults.site
For small installations, it's sufficient to define allowed content editors using an array (done inside config/defaults.site). To support i.e. LDAP this can be done by configure an callable (class or function):
Enterprise (ISP):
It's possible to use uup-site to bootstrap multiple virtual hosts for your customers if you're hosting an ISP. The full details can be read on enterprise setup page.
The benefits are:
- Approximate 200kB if disk space used per virtual host.
- Define a central bank of themes that can be used.
- Single place for update (just the shared directory for uup-site)
Further information:
For more information, please visit the project page