{"id":18427108,"url":"https://github.com/nowisesys/uup-site","last_synced_at":"2025-04-13T19:38:42.824Z","repository":{"id":57028828,"uuid":"167271532","full_name":"nowisesys/uup-site","owner":"nowisesys","description":"Micro framework for building lean and mean web applications and sites","archived":false,"fork":false,"pushed_at":"2019-10-15T03:01:22.000Z","size":1590,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-16T08:27:30.204Z","etag":null,"topics":["php-framework","site","webapp"],"latest_commit_sha":null,"homepage":"https://nowise.se/oss/uup/site/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nowisesys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-23T23:46:47.000Z","updated_at":"2019-10-15T03:01:24.000Z","dependencies_parsed_at":"2022-08-23T16:20:27.939Z","dependency_job_id":null,"html_url":"https://github.com/nowisesys/uup-site","commit_stats":null,"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-site","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-site/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-site/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-site/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nowisesys","download_url":"https://codeload.github.com/nowisesys/uup-site/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248769383,"owners_count":21158808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php-framework","site","webapp"],"created_at":"2024-11-06T05:09:39.740Z","updated_at":"2025-04-13T19:38:42.801Z","avatar_url":"https://github.com/nowisesys.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## UUP-SITE - Web application and site framework\n\nThis package is a micro framework that takes a object oriented approach at building \nlarge scale web sites and web applications in PHP. Designed with small memory footprint, easy of use and fast execution in mind.\n\nControllers are placed direct under public and derives from suitable base classes to \ndefine their behavior (i.e. being a public web page or a secured JSON service) and is\nalso responsible for loading their views. The dispatcher takes care of natural routing\nfrom request path to controller.\n\nIf a public page don't contains a class, then its treated as a simple view by the \ndispatcher that takes care of wrapping it up inside a view controller before rendering\nit with decorations.\n\n### Quick start:\n\nFor those impatient to try this out without any further reading:\n\n```bash\ncomposer require nowise/uup-site\n./vendor/bin/uup-site.sh --bootstrap\n./vendor/bin/uup-site.sh --location /myapp --setup --auth --edit --locale --guide --examples\n```\n\nCreate a symbolic link to public under your htdocs and point your favorite browser\nat /myapp should get you started:\n\n![Screenshot of getting started page](https://nowise.se/oss/uup/images/uup-site-5.png)\n\nPretty simple, right?\n\n### Features:\n\nSupports for multiple theme, rendering page content direct or using a dispatcher (routing) script and designed with these goals:\n\n* Suitable for web interfaces, AJAX or services (i.e. API in JSON or SOAP)\n* Responsive design with multiple themes\n* Small memory footprint (~500kB per request)\n* Fast request handling (less than 0.01 ms per request) \n* Support for internationalization (I18N) and localization (L10N)\n\n### Site config:\n\nThe config/defaults.site file is looked for in the package directory (vendor/nowise/uup-site)\nor in the site directory (the virtual host directory). Support for auth and edit is disabled by default, enable them in config/defaults.site.\n\n### Setup (web sites):\n\nThe recommended solution is to use the uup-site.sh for setting up instances using\nuup-site. For installation thru composer its located under vendor/bin. When installing\na virtual host, make sure that public is the only directory exposed to outside\nworld.\n\n```bash\ncd /usr/local/bin\nwget https://nowise.se/oss/uup/site/files/uup-site.sh\n```\n\nTo bootstrap and initialize a new virtual host:\n\n```bash\nmkdir -p /var/www/example.com \u0026\u0026 cd mkdir -p /var/www/example.com\nuup-site.sh --bootstrap\nuup-site.sh --setup\n```\n\nReview content of the public and config directories once setup has finished. Decide upon if \npage routing (mod_rewrite) should be used or not. Complete the setup by defining the public \ndirectory as document root (if developing a web site).\n\nSee https://nowise.se/oss/uup/site/usage/setup/ for more setup alternatives,\nincluding bootstrap, composer, archive or manual.\n\n### Themes:\n\nThemes are bundled under the theme directory and consists of public content \nand template files. During render phase, a matching theme and template (*.ui)\nfile is looked for under the template directory.\n\n### Infrastructure:\n\nMenus and publish information can either be defined by having custom files in\nthe page directory or programmatically by redefining menu content in the page \nconstructor.\n\nSee example/context for infrastructure example. See example/multi for example\non programatically defined menus. The site config file has some influence on menu \nhandling too.\n\nSee example/context/menus for more advanced menus, like dynamic update page content\nor defining menus relative current site root.\n\n### Controllers, dispatch and rendering:\n\nA page class can be rendered either direct or using routing. Using dispatch routing\nis the recommended method that in addition supports views and provides pretty\nURL's.\n\n##### Rendering (direct):\n\n```php\n// \n// Assume virtual host defines include path to root directory:\n// \nrequire_once('vendor/autoload.php');\n\nuse UUP\\Site\\Page\\Web\\StandardPage;\n\nclass IndexPage extends StandardPage\n{\n    // Define the printContent() member function at least.\n};\n\n$page = new IndexPage();\n$page-\u003erender();\n```\n\n##### Rendering (dispatch):\n\n```php\n// \n// The dispatcher.php (router) has already setup autoloading, no need\n// to explicit call render() either.\n// \nclass IndexPage extends StandardPage\n{\n    // Define the printContent() member function at least.\n};\n```\n\nMore examples is included in example directory in the source package. It's recommended\nthat your application derives your own controllers from the provided base classes to\nsupport JSON or file API.\n\n### Views:\n\nWhile pages are complete classes, views are simple files that contains just\nthe main section content (HTML/PHP fragments). Using routing is the recommended \nmethod for render views.\n\nUsing standard page class for rendering views makes the context (i.e. menus) \navailable for decoration. Views are intended for web sites, while pages are \nmore targeted at web application (more control).\n\n### Authentication:\n\nEnable authetication by running uup-site.sh. The config/auth.inc file needs to be \ntweaked with supported authenticators.\n\n```bash \nuup-site.sh --auth\n```\nYou will need to enabled authentication settings inside config/defaults.site. An \ncontroller can enforce authentication by deriving from a secure base class. It's also\npossible to programmatically enforce authentication from within a public controller\ni.e. based on requested view.\n\n### Namespace:\n\nThe default dispatcher setup will not support namespaces in controllers. If you like\nto use namespace in them, the modify public/dispatch.php:\n\n```php\n$router = new Router();\n$router-\u003esetNamespace(\"\\\\\");                        // Use global namespace\n$router-\u003ehandle();\n```\n\nIf your controller is i.e. located inside public/api/customer, then use the namespace\nAPI\\Customer inside that controller. If you like to use application prefix in your namespace\nnames, i.e MyApp\\Controllers\\API\\Customer, then define your namespace as:\n\n```php\n$router = new Router();\n$router-\u003esetNamespace(\"\\\\MyApp\\\\Controllers\\\\\");    // Harmonize with application namespace\n$router-\u003ehandle();\n```\n\n### Locales and translation:\n\nEnable locale (gettext) support using uup-site.sh:\n\n```bash\nuup-site.sh --locale\n(i) Edit settings in makefile, then run 'make new-locale' and 'make' in current directory.\n```\n\nThis will create a locale directory and install a makefile in current directory. If the \nsite/application is huge, then its recommended to use multiple text domains:\n\n    uup-site\n      ├── htdocs/                       // Document root\n      │     ├── dir1/\n      │     ├── dir2/\n     ...   ...\n      ├── locale/                       // Support for locale (gettext)\n      │     ├── dir1.pot\n      │     ├── dir2.pot\n     ...   ...\n\nEach page can initialize its own text domain in the constructor:\n\n```php\nclass MyPage extends StandardPage\n{\n\n    public function __construct()\n    {\n        parent::__construct(_(\"My page\"));\n        $this-\u003elocale-\u003esetTextDomain(\"dir2\");\n    }\n     \n}\n```\n\n### Online content editor:\n\nEnable CMS by running uup-site.sh. You need to install javascript libraries and\ntweak the edit settings inside config/defaults.site\n\n```bash \nuup-site.sh --edit\n```\n\nFor small installations, it's sufficient to define allowed content editors using\nan array (done inside config/defaults.site). To support i.e. LDAP this can be done\nby configure an callable (class or function):\n\n```php\n// \n// Naive example support for LDAP using hypotetical object:\n// \n'edit' =\u003e array(\n    'user' =\u003e function($user) use($ldap) {\n        return $ldap-\u003eexist(array('uid' =\u003e $user));\n    },\n)\n```\n\n### Enterprise (ISP):\n\nIt's possible to use uup-site to bootstrap multiple virtual hosts for your customers\nif you're hosting an ISP. The full details can be read on [enterprise setup](https://nowise.se/oss/uup/site/usage/setup/enterprise) page.\n\nThe benefits are:\n\n* Approximate 200kB if disk space used per virtual host.\n* Define a central bank of themes that can be used.\n* Single place for update (just the shared directory for uup-site)\n\n### Further information:\n\nFor more information, please visit the [project page](https://nowise.se/oss/uup/site)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnowisesys%2Fuup-site","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnowisesys%2Fuup-site","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnowisesys%2Fuup-site/lists"}