GithubHelp home page GithubHelp logo

phpmv / ubiquity Goto Github PK

View Code? Open in Web Editor NEW
681.0 24.0 60.0 25.27 MB

Ubiquity framework

Home Page: https://ubiquity.kobject.net

License: Apache License 2.0

PHP 94.05% HTML 5.84% JavaScript 0.11% CSS 0.01% Shell 0.01%
php framework orm performance ubiquity mvc

ubiquity's Introduction

img

Scrutinizer Code Quality Code Coverage Documentation Status Packagist PHP Version Support Latest Stable Version License Total Downloads Monthly Downloads GitHub commits since latest release (by date) Join the chat at https://gitter.im/ubiquity-framework/community

Ubiquity, a powerful and fast framework for efficient design.

Main features

  • MVC or Domain Driven Design with MVC
  • Dependency injection
  • PSR-4 Autoloader
  • Router based on annotations/attributes
  • ORM implementing Data Mapper
  • Multi-databases & multi-database types support (PDO Mysql/PostgreSQL/SQLite, Mysqli, Swoole coroutine Mysql, Tarantool, MongoDB)
  • Multi-level cache
  • Rest Server
  • Web admin interface (Webtools)
  • Scaffolding (CRUD, REST, Controllers, views, authentification...)
  • Console Admin interface (Devtools)
  • Assets & themes management (since 2.1.0, on a proposal from @Gildonei)
  • Managed servers: fpm/fastcgi with Apache or nginX, ngx_php, Workerman, Swoole, Roadrunner, PHP-PM with ReactPHP (Dev only)
  • Multi template engines support: Twig(default), Latte and Plates since 2.5.2

Upgrade

If Ubiquity devtools are already globally installed, and you want to upgrade to the lastest stable version:

composer global update

For an existing project (in the root folder):

composer update

Project creation

The easiest way to create a project is to use composer create-project command:

Creation of the project firstProject

composer create-project phpmv/ubiquity-project firstProject

This installation adds devtools and webtools to the project.

  • Running the server with vendor/bin/Ubiquity serve
  • webtools available at http://127.0.0.1:8090/Admin

Devtools installation

It is also possible to install devtools globally, to share their use between different projects, and to get more options for a project creation.

  • Install Ubiquity-devtools:
composer global require phpmv/ubiquity-devtools
  • Create a project:
Ubiquity new firstProject -a
  • Start the server:
Ubiquity serve

Need some help?

Ubiquity is a recent project and does not yet have a large community. In the meantime, you can consult:

For further assistance please feel free to :

  • ask your questions directly using gitter
  • create an issue if you notice a bug or a suspicious behavior

Performances

Ubiquity is very fast and performs well.

In the PHP world

The various results of the Techempower benchmarks show this conclusively.

TechEmpower Multiple queries test (*) (see PHP frameworks results)

image

These excellent results have also been confirmed by an independent benchmark site : phpbenchmarks.com

In the world of web frameworks

Ubiquity is optimized for use with asynchronous platforms (Workerman and Swoole). It takes advantage of the recent PHP evolutions (opCache management and preloading). In this context, it performs against the fastest Frameworks written in C, C++, Rust or java:

TechEmpower 20 updates test (*) (see All frameworks results)

image

(*) Only tests with Framework and ORM are considered.

About design choices

Ubiquity was created in April 2017.

The project tries to simplify the development process, and empowers web developers who delivering value through their applications. It aims to combine performance and ease of handling.

This dual purpose has led to some design choices:

Get inspired by the best practices and successful concepts from other frameworks, but do not try to reproduce things that are not a part of the logic of PHP.

Some PHP frameworks were inspired by the Java world, which has contributed to more professional php development. But java is not PHP : the environments and languages are completely different (though their syntax is similar). What is good in Java is not necessarily in PHP.

Ubiquity wants to keep the essence of PHP and what it does best, for example:

  • By using php (packed) arrays because they are effective in php (with php7 optimization)
  • By not creating instances of classes to inject for the core part of the framework, to prefer the use of classes with static methods

Overall, Ubiquity wants to keep and use what PHP is good at.

In this perspective, Ubiquity chooses not to respect certain standards: For example, by not creating a Response object implementing an interface (see PSR-7 HTTP message interfaces ) in response to an Http request.

Not multiplying the ways of doing things.

If a method or technique is optimal, there's no reason to implement an alternative version, especially if there is a risk of degrading the performance or complicating the handling of the framework.

Avoiding multiple external dependencies, which are sometimes loaded when they are never used.

  • They prevent the developer from optimizing his own code.
  • In some applications, the dependency loading time is more expensive than running the application code.

The framework used must give the developer the means to optimize his application and not the other way around.

Ubiquity aspires to never become another labyrinthine system.

Preview of some features

Devtools console program

Ubiquity help

The console mode makes it easy to perform all the repetitive tasks related to the design of projects:

  • creations : project, controllers, actions, routes, models, views,
  • checking : routes, models, validators
  • scaffolding (CRUD + authentification)

Scaffolding

Generation of the CRUD elements for a model class with devtools :

Ubiquity crud --resource=Developers --path=/devs/

The generated route /devs/ provides an entry point for CRUD operations:

crud index

Admin interface

Like the console, the administration interface makes it possible to act on the main components of the framework.

When creating a project, it can be installed with the -a option.

ubiquity new firstProject -a

Admin interface

Graphic design

Donations

You can tell us your pleasure in using Ubiquity, giving us a star, and you can do even better by contributing...

Thank you!

ubiquity's People

Contributors

andrewvh619 avatar churow avatar gildonei avatar gitter-badger avatar jcheron avatar jyyan avatar kaznovac avatar n0nag0n avatar ndl-1990 avatar orbex avatar richardbmx avatar s-patompong avatar tiippex avatar transifex-integration[bot] avatar trk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ubiquity's Issues

[ORM] model Table annotation

Steps

Hello ,

ref as [part] ORM Table annotation #14

I got the
@table("db_table_name")
work for me, but
@table("name"=>"db_table_name")
is not work.

then i found that the TableAnnotation L22 only check & take the array $properties[0] as annotation name. but missing to check map $properties['name']

when i patch with below it work fine for me

/**
* Initialize the annotation.
*/
public function initAnnotation(array $properties) {
    error_log(var_export($properties, true));
    /*
        array (
        'name' => 'db_table_name',
        )
    */
    if (isset ( $properties [0] )) {
        $this->name = $properties [0];
        unset ( $properties [0] );
    } else if (isset ( $properties ['name'] )) {
        $this->name = $properties ['name'];
        unset ( $properties ['name'] );
    } else {
        throw new \Exception ( 'Table annotation must have a name' );
    }
}

Expected Result

Actual Result

PHP Fatal error:  Uncaught Exception: Table annotation must have a name in /vendor/phpmv/ubiquity/src/Ubiquity/annotations/TableAnnotation.php:27
Stack trace:
#0 /vendor/mindplay/annotations/src/annotations/AnnotationManager.php(296): Ubiquity\annotations\TableAnnotation->initAnnotation(Array)
#1 /vendor/mindplay/annotations/src/annotations/AnnotationManager.php(263): mindplay\annotations\AnnotationManager->getAnnotations('models\\Sys_logs', 'class')
#2 /vendor/mindplay/annotations/src/annotations/AnnotationManager.php(594): mindplay\annotations\AnnotationManager->getAnnotations('models\\Sys_logs', 'property', '$id')
#3 /vendor/mindplay/annotations/src/annotations/Annotations.php(90): mindplay\annotations\AnnotationManager->getPropertyAnnotations('models\\S in /vendor/phpmv/ubiquity/src/Ubiquity/annotations/TableAnnotation.php on line 27

Versions

· PHP 7.1.27-1+ubuntu18.04.1+deb.sury.org+1
· Ubiquity devtools (1.2.3)
· Ubiquity 2.1.2

Trojan.Script.Miner.gen

14.04.2019 06.34.23;Object (file) detected;C:\Users\aapav\AppData\Local\Composer\files\phpmv\ubiquity\dc3f6a6ecf8fcd5ed70d65848d49e9f2a2d14023.zip//phpMv-ubiquity-7079bf9/src/tests/files/.travis-copie.yml;C:\Users\aapav\AppData\Local\Composer\files\phpmv\ubiquity\dc3f6a6ecf8fcd5ed70d65848d49e9f2a2d14023.zip//phpMv-ubiquity-7079bf9/src/tests/files/.travis-copie.yml;HEUR:Trojan.Script.Miner.gen

DevTools - new parameter for project creation

Summary

I would like to suggest the inclusion of new parameters for project creation that will allow to specify siteUrl in config.php and RewriteBase in .htaccess

Motivation

I always use apache vHosts for all projects, this way I can simulate the real host/domain and rewrite rules properly.

Compatibility with Ubiquity's philosophy

Indicate compatibility or improvements in:

  • ease of use

Expected results

Inclusion of new project creation parâmeters

[RFC] Migrations

Summary

Create a native integration with PHP Phinx to generate database sync and throught developement, tests and production servers

Motivation

Almost all developers have to maintain code and database up-to-date and it includes deploy databases fixes and new features through those different servers.

Compatibility with Ubiquity's philosophy

Indicate compatibility or improvements in:

  • ease of use
  • code standardization
  • framework resources
  • agility on database maintenance

Expected results

A easy way to deploy database modifications through different servers

Additional context

Project on Github - https://github.com/cakephp/phinx
Docs - https://book.cakephp.org/3.0/en/phinx.html

[devtools] Ubiquity command unavailable after installation

Steps

installed Ubiquity as stated in guide:
composer global require phpmv/ubiquity-devtools

Expected Result

Expected that command Ubiquity will be globally available

Actual Result

Ubiquity installed to location:
$HOME/.composer/vendor/phpmv/ubiquity-devtools/src/
but it is not added to $PATH so it is not available as in guide.

When specifying full path everything works fine.

Versions

  • Ubiquity framework 2.1.2
  • Ubiquity devtools 1.2.3
  • php x7.3.4-1
  • OS ubuntu19.04.1

[Logging] init logger fails if debug=false

Steps

in app/config/config.php, debug mode is deactivated:
"debug"=> false
Logging is initialized in app/config/services.php:
\Ubiquity\log\Logger::init($config);

Expected Result

Logging is disabled.

Actual Result

The following error is generated

Fatal error: Uncaught Error: Call to a member function _warn() on null in ...\vendor\phpmv\ubiquity\src\Ubiquity\log\Logger.php on line 64

Versions

  • Ubiquity framework 2.1.2
  • Ubiquity devtools 1.2.3
  • php 7.2.3

[RFC] Add Tarantool database support

Summary

Ability to add support for Tarantool database support. Tarantool is a NoSQL database with support of SQL syntaxes.

Motivation

Tarantool is both in memory based database as well as in disc memory database. It is also blazing fast and beats Redis in many of the compared benchmarks.
The aim of Ubiquity is to be fast and Ubiquity together with support of Tarantool database would be awesome !

Compatibility with Ubiquity's philosophy

Indicate compatibility or improvements in:

  • performances
  • ease of use

Expected results

Tarantool has a very high RPS and will boost the performance additionally.

Additional context

There is a package , https://github.com/tarantool-php/client, which makes it easy to connect to Tarantool and is able to make both NoSQL as well as SQL requests out of the box.

There is also another php package for Tarantool php-mapper which is awesome and supports object models, like Eloquent models, for Tarantool database which could be awesome to use as well.

Regards

[CRUD][webtools][models] model form validation does nothing (no submit)

Steps

in webtools:

  • go to the Models section.
  • select a table (model),
  • add or modify an instance
  • If the form is displayed in a modal window (number of instances greater than 5), and one of the form fields does not meet the validation criteria
  • click on the validate button

Same problem with a CRUDController

Expected Result

Clicking on the validate button closes the modal window and submit the form =>database update or add

Actual Result

Clicking on the validate button closes the modal window, without any form submission.

Versions

  • Ubiquity framework 2.1.0
  • Ubiquity devtools 1.2.3
  • php 7.3.2

[webtools][rest] SimpleRestController Error 500 on adding

Steps

  • create a new Resource/controller Rest inheriting from SimpleRestController
  • Add an instance (POST) with webtools interface

Expected Result

  • Status 200 or 201
  • instance created

Actual Result

  • Status 500 : unable to insert the instance

Versions

  • Ubiquity framework 2.1.1
  • Ubiquity devtools 1.2.3
  • php 7.3.2

[Config] Database Connection Silently Fails

Steps

Simply setup a project with a database name that doesn't exist.

Expected Result

An exception be thrown.

Actual Result

A message gets echo'ed and program continues. (See \Ubiquity\db\Database::connect)

Versions

  • Ubiquity: 2.0.11
  • PHP: 7.1.27
  • OS: Ubuntu 18.04

[RFC] Themes layout support

Summary

Theme support

Motivation

Reading the docs, I didn't found anything indicating that Ubiquity supports theme layouts, like CakePHP as a sample, Where I can have multiples themes and set the theme to be used on controller and It will render specified view with specific theme.

Compatibility with Ubiquity's philosophy

Indicate compatibility or improvements in:

  • ease of use
  • design modularity

Expected results

With theme support, we could develop projects and control design versions or create CMSs where users could choose his own theme to apply to his websites

Additional context

CakePHP theme support is a good refer to this feature

[break] Ubiquity 2.1.5 will be 2.2.0

The next version of ubiquity will introduce some breaking changes.

Some classes have been relocated.

  • CodeUtils->Ubiquity\utils\base\CodeUtils
  • HasModelViewerInterface->Ubiquity\controllers\crud\interfaces\HasModelViewerInterface
  • ModelViewer->Ubiquity\controllers\crud\viewers\ModelViewer

The webtools will no longer be part of the main repository but will be in their own repository:
phpmv/ubiquity-webtools

The purpose of this separation is to optimize Composer autoloading. In production, webtools are not necessarily useful.

This version will therefore be a minor version 2.2.0 and not a patch version 2.1.5.

strpos usage deprecation warning

strpos usage deprecation warning

PHP Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /Users/ekscrypto/dev/ubiquityProject/vendor/phpmv/php-mv-ui/Ajax/service/JString.php on line 6

Steps

Ubiquity serve a new project
Use any of the UbiquityMyAdmin pages, check the console logs

Expected Result

No deprecation warning visible

Actual Result

strpos warning shown, see above

Versions

  • Ubiquity framework dev-master (2019-02-26)
  • Ubiquity devtools 1.1.5
  • php 7.3.2

[RFC] Cron Tasks

Summary

Allow developers to execute Controller actions on shell, without renders

Motivation

Shell tasks are a very commom need on projects that need to run routines to update status, reports, consolidate datas, and other stuff.

Compatibility with Ubiquity's philosophy

Indicate compatibility or improvements in:

  • ease of use
  • framework resources

Expected results

Be possible to run controller actions through shell or command line without renders and keeping framework funcionalities like ACL and others.

Additional context

Framework should be able to re-use models actions and framework actions almost like it was being executed on a web broser.

A sample case could be send a Birthday mail for Customers from an e-commerce

[RFC] E-mail module

Summary

Module to send authenticated e-mail using SMTP

Motivation

Almost all if not all websites or web systems have at least one contact form or a feature that needs to send an e-mail to someone.

Compatibility with Ubiquity's philosophy

Indicate compatibility or improvements in:

  • performances
  • ease of use
  • code standartization

Expected results

Be possible to configure (maybe in config.php) e-mail accounts (sender name, sender e-mail, smtp, port, host, encryption method, encoding, other info) and use it to send authenticated e-mails, trying to avoid span and server errors.

Additional context

Framework could use PHPMailer (https://github.com/PHPMailer/PHPMailer) or have a list of Mailer sender pre-built were developers could choose on framework installation just like they can choose theme and jslib to install on framework

New project template using DevTools has invalid link to Admin page

New project template using DevTools has invalid link to Admin page

Steps

$ Ubiquity new ubiquityProject -a -q=semantic
$ cd ubiquityProject
$ Ubiquity serve
...
· Starting php server at 127.0.0.1:8090...

Using a browser open http://127.0.0.1:8090

Expected Result

In the footer of the page, there should be a link "UbiquityMyAdmin" link that points to: http://127.0.0.1:8090/Admin

Actual Result

In the footer of the page, there is a "UbiquityMyAdmin" link that points to: http://127.0.0.1/ubiquityProject/Admin

Versions

  • Ubiquity framework dev-master (2019-02-26)
  • Ubiquity devtools 1.1.5
  • php 7.3.2

[webtools] Main menu links activation failed

Steps

In webtools (/Admin)

  • a click on an element in the page does not activate the corresponding link in main menu:
    image

  • In a part (/Admin/Controller), reloading the page (F5 key on the keyboard) causes the active menu item to be lost

Expected Result

image

Actual Result

image

Versions

  • Ubiquity framework 2.1.3
  • Ubiquity devtools 1.2.5
  • php 7.3.2
  • OS

Call for graphic designers and good ideas

Developers are not graphic designers, at least not me.
And design is important too.

The current graphic charter is limited to the use of 3 colours:

  • #4DA0B0
  • #D39D38
  • #333333

The Ubiquity title uses the font family Righteous:
image
The subtitle: Poiret One
image

However, Ubiquity does not have a logo,
other than this simple U found on the Internet, which acts as a favicon:
image

This U should invoke the fundamentals of the framework, performance and ease of use, or simply be esthetic and identifiable.

I therefore appeal to all those of good will who feel like the soul of a graphic designer, to those who have the skills, and to all those who have ideas.
This current U is pathetic!

Empty DateTime in Admin -> Model -> Data -> Edit

Steps

Access /Admin/showModel/model.ModelName -> edit a record and all DateTime fields are empty, when it should be field with it's values

Expected Result

DateTime fields to be restored with values

Actual Result

DateTime fields are empty

Versions

  • Ubiquity framework
  • Ubiquity devtools 1.1.7
  • php 7.1.9
  • OS Win10

[Contributing] to Ubiquity Demos

Getting information

Consulting the guide is a good thing to better apprehend a feature. It is also sometimes useful to search in the API.

By way of example

But nothing is better than a good example directly implemented in a project.
This is the purpose of the repository Ubiquity-demos.
A demo is a project, in which a feature or group of features has been implemented.

Share your experiences

If you have started testing Ubiquity, you can also share your examples of code by contributing to Ubiquity-demos

[Views][twig] Fatal error : cache can only be a string

Steps

Enable twig view caching in config.php

"templateEngineOptions"=>array(
			"cache"=>true
			)

Expected Result

Caching Twig views works!

Actual Result

Fatal error: Uncaught LogicException: Cache can only be a string, false, or a \Twig\Cache\CacheInterface implementation. in \ubiquity\vendor\twig\twig\src\Environment.php:274

Versions

  • Ubiquity framework 2.1.1
  • Ubiquity devtools 1.2.3
  • php 7.2.3

I contact you

I contacted you by mail with the mail that you put in description of your Github profile.

[Views][Twig] config["siteURL"] return null or blank

Steps

Configuration in app/config/config.php:

<?php
return array(
	"siteUrl"=>"http://127.0.0.1/mySite/",
...

Expected Result

In client-side HTML source code, base href should contain siteUrl value

<!DOCTYPE html>
<html>
<head>
	<base href="http://127.0.0.1/mySite/">
	<meta charset="UTF-8">

Actual Result

base href is blank

<!DOCTYPE html>
<html>
<head>
	<base href="">
	<meta charset="UTF-8">

Versions

  • Ubiquity framework >2.0.4
  • php >7.0

Next version will be 2.3.0

Release date

tomorrow August 1

New features and updates

multi db

Version 2.3.0 will support connection to multiple databases, in a transparent way (thanks @gildonei for its RFC)

functioning

No more need to start the database in the app/config/services.php file with DAO::startDatabase($config).

//The connection is automatically made at the first request to the database.
$user=DAO::getById(User::class,1);

With several databases, the services.php file must include the instruction DAO::start(), to allow the framework to determine which base is requested for each model.

A model is defined for a database, using the @database annotation:

namespace models\accounting;

/**
 * @database('accounting')
*/
class Products{
}

You don't have to do it manually since models can be generated automatically, from webtools or devtools, for a specific connection to a database

Database connections are defined in app/config/config.php:

return array(
	"siteUrl"=>"http://127.0.0.1:8090/",
	"database"=>array(
			"default"=>array(
					"type"=>"mysql",
					"dbName"=>"uguide",
					"serverName"=>"127.0.0.1",
					"port"=>3306,
					"user"=>"root",
					"password"=>"",
					"options"=>array(),
					"cache"=>false
					),
			"accounting"=>array(
					"type"=>"mysql",
					"dbName"=>"accounts",
					"serverName"=>"127.0.0.1",
					"port"=>3306,
					"options"=>array(),
					"user"=>"root",
					"password"=>"",
					"cache"=>false
					)
			),

Connections can be managed from webtools, without having to directly modify the configuration file:

image

It is then possible to request the models, without worrying about the connections to the database:

In app/config/services.php:

DAO::start();

In controllers:

//The connection is automatically made at the first request to the default database.
$user=DAO::getById(User::class,1);
...
//The connection is automatically made at the first request to the accounting database.
$products=DAO::getAll(Products::class);

Optimization

Autoloader optimization

Classes used only in development (and not in production), such as webtools and devtools, have been moved to the new phpmv/ubiquity-dev repository.

This moving is transparent for the developer.

Attention, in case of optimization of the autoloader for production:

composer install --optimize-autoloader --classmap-authoritative --no-dev

the removal of packages declared in -dev (of which ubiquity-dev is a part) then prohibits the use of webtools or devtools.

Startup optimization

The efficiency of the framework startup has been improved (especially in the Startup class)

Results

The benchmarks achieved (bench used: Techempower multiple queries x20) show the improvements:
image

[RFC] Allow multiple databases

Summary

Allow framework to use multiple databases.

Motivation

Some projects may need to utilize different database connections on same project, so, Ubiquity should allow to configure a "default" database and extra connections.

Compatibility with Ubiquity's philosophy

Indicate compatibility or improvements in:

  • ease of use
  • flexibility

Expected results

Be able to connect to different databases

Additional context

Models must be able to specify wich database will be use. If none was specified, it uses default database connection

config.php

return array(
	"siteUrl"=>"http://ubiquity.local",
	"database"=>array(
		"default" => array(
			"type"=>"mysql",
			"dbName"=>"database_name",
			"serverName"=>"0.0.0.0",
			"port"=>3306,
			"user"=>"database_user",
			"password"=>"database_pswd",
			"options"=>array(),
			"cache"=>false
		),
		"extra1" => array(
			....
		),
	),
...

[AuthController] Admin Interface shows password instead of email near "Logout" button

Hi,

I followed the steps to implement the AuthController to the admin interface using the guide.
All is working fine until I saw an error in display.

I did no changes at core files.

Expected Result

In front of the "Logout" button should be the email of currently logged in user.

Actual Result

In my case the password is shown instead ?!

Versions

  • Ubiquity framework 2.2.0 (Latest , Downloaded on 15/07/2019)

Kind regards,
ndL-1990

DevTools - Error creating new project

Got error when creating a new project with semantic theme only

Step 1

C:\wamp64\www\ubiquity>Ubiquity new html -a -themes=semantic -b=dsv_ubiquity -s=192.168.0.70 -u=ubiquity -w=ubiquity The html folder already exists ! Would you like to continue ? (y/n) y Files copy... Config files creation... command line arguments : siteUrl='http://127.0.0.1/html/', projectName='html', injections='', cssFiles='', jsFiles='', dbName='dsv_ubiquity', dbType='1', serverName='192.168.0.70', port='3306', user='ubiquity', password='ubiquity', all-models='1', phpmv='', admin='1'

Warning 1

■ warning : Themes installation · The theme 1 does not exists!

Error 1

Error!: could not find driver<br/> ■ error · Message : Call to a member function query() on null · File : C:\wamp64\www\ubiquity\html\vendor\phpmv\ubiquity\src\Ubiquity\orm\creator\database\DbModelsCreator.php · Line : 34

Expected Result

Creation of new project with semantic theme only

Actual Result

Fatal error

Versions

  • Ubiquity devtools 1.2.5
  • php 7.1.9
  • Windows

ubiquity Feature

ubiquity is very good framework. but not famous because:
1- The name "Ubiquity" is Not Unique and cute name.
2- The document and guide of it is not enough. we need Video in YouTube and more article.

.

[scaffolding][Auth]Fatal error: Uncaught Error: Class 'controllers\DAO' not found in C:\...\app\controllers\BaseAuthController.php:24 Stack trace: #0

Hello ,I encountered the following problem when i test scafolding->Auth
https://micro-framework.readthedocs.io/en/latest/scaffolding/auth.html

Fatal error: Uncaught Error: Class 'controllers\DAO' not found in C:...\app\controllers\BaseAuthController.php:24 Stack trace: #0

MyBaseAuthController.php

getOriginalURL(); USession::set($this->_getUserSessionKey(), $connected); if(isset($urlParts)){ Startup::forward(implode("/",$urlParts)); }else{ Startup::forward("admin"); } } protected function _connect() { if(URequest::isPost()){ $email=URequest::post($this->_getLoginInputName()); $password=URequest::post($this->_getPasswordInputName()); return DAO::uGetOne(User::class, "email=? and password= ?",false,[$email,$password]); } return; } /** * {@inheritdoc} * @see \Ubiquity\controllers\auth\AuthController::isValidUser() */ public function _isValidUser($action = null) { return USession::exists($this->_getUserSessionKey()); } public function _getBaseRoute() { return 'BaseAuthController'; } /** * {@inheritdoc} * @see \Ubiquity\controllers\auth\AuthController::_getLoginInputName() */ public function _getLoginInputName() { return "email"; } } Admin.php

PHP Fatal error: Uncaught Error: Class 'Ajax\php\ubiquity\JsUtils' not found in .....vendor/phpmv/ubiquity/src/Ubiquity/core/Framework.php:87

I faithfully followed the quick start of the documentation. Installation occurred smoothly. The server runs smoothly using the "Ubiquity serve" command. But when trying to access the site the console prints this error:

PHP Fatal error: Uncaught Error: Class 'Ajax\php\ubiquity\JsUtils' not found in /home/eduilson/Documents/als/ubiquity/vendor/phpmv/ubiquity/src/Ubiquity/core/Framework.php:87

Ubiquity version output:
PHP 7.2.4-1+b1
Ubiquity devtools (1.2.0)
Ubiquity 2.1.0

jquery variable in views

    public function __construct(){
        if(!$this->isValid())
            $this->onInvalidControl();
        $this->view=new View();     
    }
    public function loadView($viewName,$pData=NULL,$asString=false){
        if(isset($pData))
            $this->view->setVars($pData);
        return $this->view->render($viewName,$asString);
    }

Ubiquity and code standards - PSRs

PHP has long suffered from the lack of standardization and shared standards. PHP-Fig has fixed this, it's a chance!

But the PHP community now tends to move towards the opposite excess, probably traumatized by the previous period.
Any project that does not comply with the PSRs is poorly considered and must be corrected accordingly.
I think that the standards are a guide (a bit like the code for pirates?), providing more flexibility to developers using a project, but that it is allowed, in certain particular cases, not to respect them, under conditions:

  • be able to justify this non-compliance, and explain the reasons for it
  • possibly adapt and implement another standard

What is dangerous is not the choice not to meet a specific standard, but to have none.
A development team working on a project, whether private or even public, always has the right to adopt its own standards!
Ubiquity does not comply with all standards, so it is important to explain the reasons:

PSR-1 & PSR-2:

see PSR-1: Basic Coding Standard and PSR-2: Coding Style Guide
Ubiquity makes two exceptions to PSR-2:

  1. Opening braces for classes, methods and functions MUST go on the same line, and closing braces MUST go on the next line after the body.

This choice is not decisive, and it depends on the habits of each one. But it is always possible to visualize the beginning of a class or a method, without seeing the opening brace.

  1. Code MUST use tabs for indenting, not spaces.

It's easy to put an unnecessary space and not realize it. It's harder not to see a tab.
Tabs allows each developer to adjust the size of the indentation on his workbench.

It is important to remember that compliance with PSR-2 does not make the quality of the code.

PSR-3:

see PSR-3: Logger Interface
Ubiquity does not respect the implementation of LoggerInterface.
This defect will have to be fixed in the future, to allow third party libraries to use the application's Log system.

PSR-4:

see PSR-4: Autoloading
Ubiquity complies with PSR-4 specifications for class autoloading:

  • For the framework sources, the Ubiquity namespace corresponds to the src/Ubiquity folder
  • For a project, the root of the namespaces corresponds to the folder app/

PSR-6:

see PSR-6: Caching Interface
Ubiquity does not comply with the specifications related to the cache system. This deficiency will probably have to be fixed in the future.
Given the nature and role of the cache system, its compliance with PSR-6 would be discontinued if it had a negative impact on performances.

PSR-7:

see PSR-7: Http messages
This is not a non-compliance with the specifications related to HTTP messages interfaces.
It's more of a design choice.
PHP does not have native HTTP Response and Request objects but gives access to the super global $_POST, $_GET, $_SERVER, $_FILES...
Ubiquity keeps this simplification of PHP, and simply allows easier handling of super globals via URequest, UResponse, UCookie, USession utility classes.
These classes do not represent Request, Response objects...and only have static methods.
PSR-7 does not have to apply in this case.

Ubiquity derives part of its performance from this compliance with PHP.
If the evolution of PHP led it to provide such objects, Ubiquity would certainly follow it in this direction.

Ubiquity does not have the maturity of other frameworks and there is still a lot to do.
All choices can be discussed,
all contributions are always welcome!

CrudMessage line 55

Title (Put in field above)

Use the format: [part] Element Should Do X
i.e. [Router] Route requirement should allow to set an integer url parameter
[part] is one of [Views,Controllers,ORM,Router,REST,Config,Git,SEO,UbiquityMyAdmin]

Steps

Expected Result

Actual Result

Versions

Ubiquity framework x.y.z
Ubiquity devtools x.y.z
php x.y.z

[Router] Route priority is not global

Steps

Either the following 2 controllers defining the routes bar1, bar2 and bar3:

namespace controllers;
/**
 * Controller AController
 */
class AController extends ControllerBase {
	public function index() {}
	/**
	 * @route("bar3")
	 */
	public function bar3() {
		echo "bar3";
	}
}
namespace controllers;
/**
 * Controller BController
 */
class BController extends ControllerBase {
	public function index() {}
	/**
	 * @route("bar1","priority"=>500)
	 */
	public function bar1() {
		echo "bar1";
	}
	/**
	 * @route("bar2","priority"=>1000)
	 */
	public function bar2() {
		echo "bar2";
	}
}

Expected Result

Taking into account the prority, these routes must be registered in order:

  1. bar2
  2. bar1
  3. bar3

Actual Result

  1. bar3
  2. bar2
  3. bar1

The priority applies only within each controller.

Versions

  • Ubiquity framework 2.1.4
  • php 7.3

[RFC] Maintenance Mode - suggestion

Summary

I think would be nice if Ubiquity have a native maintenance mode, that could be activated in config through webadmin or devtools, and when in maitenance, it only allows backend access interface, and in front a page with a maintenance message or similar

Motivation

All major CMS (WordPress, Joomla, Drupal) have a similar functionality, that allows properly config system without break the front, keeping a maintenance page and maybe an http respose

Compatibility with Ubiquity's philosophy

Indicate compatibility or improvements in:

  • ease of use

Expected results

Visitors of website developed with Ubiquity will see a maintenance page instead of the site while It is setted to be down.

[Router] getRouteByName returns false if method is specified

Steps

1 - Define a route with a name and a specific method:

class FooController extends Controller {
	/**
	 *
	 *@get("foo/bar","name"=>"foo.bar")
	 */
	public function bar() {}
}

2 - Init router cache
3 - Get the route with its name
Router::getRouteByName('foo.bar') returns false

In twig:
{{ path('foo.bar') }} returns an empty string

Expected Result

The associated route

Actual Result

false or an empty string

Versions

  • Ubiquity framework 2.1.4

[Router] [Nginx] [configuration] Undefined index: c

Steps

Using the following Nginx conf:

server {
        listen 80;

        root /var/www/html;
        index index.php index.html index.htm;

        server_name uniquity.local;

        # From the docs: https://micro-framework.readthedocs.io/en/latest/confproject.html
        location / {
		try_files $uri $uri/ /index.php?c=$query_string;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}

Go to the web root ("/") and $_GET['c'] will not be set causing an error on line \Ubiquity\controllers\Startup:73

Expected Result

If the $_GET['c'] variable is not set, it defaults to '_default'.

Actual Result

Throws a notice error.

Versions

  • Ubiquity: 2.0.11
  • PHP: 7.1.27
  • OS: Ubuntu 18.04

[Views][Theme] The ThemesManager write config.php without validation

Steps

in the Ubiquity quick-start project, Index Controller ct action

I found the ThemesManager::saveActiveTheme method will write $activeTheme into config.php directly, without any filter and check the theme is exist or not.

it will cause error when I send request as http://127.0.0.1:8000/IndexController/ct/bootstrap" or http://127.0.0.1:8000/IndexController/ct/bootstrap' or http://127.0.0.1:8000/IndexController/ct/SomeErrorString

Expected Result

ThemesManager::saveActiveTheme maybe have to filtered the invalid ThemeName string before write into config.php

Actual Result

the config.php got wrong value of activeTheme such like :

	"templateEngineOptions"=>array(
			"cache"=>false,
			"activeTheme"=>"bootstrap""
			),

or

	"templateEngineOptions"=>array(
			"cache"=>false,
			"activeTheme"=>"bootstrap'"
			),
PHP Parse error:  syntax error, unexpected '"' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /app/config/config.php on line 21

or

	"templateEngineOptions"=>array(
			"cache"=>false,
			"activeTheme"=>"SomeErrorString"
			),
Tue May  7 07:56:28 2019] PHP Fatal error:  Uncaught Exception: View @activeTheme/main/vHeader.html not found! in /vendor/phpmv/ubiquity/src/Ubiquity/views/View.php:75
Stack trace:
#0 /vendor/phpmv/ubiquity/src/Ubiquity/controllers/Controller.php(67): Ubiquity\views\View->render('@activeTheme/ma...', false)
#1 /app/controllers/ControllerBase.php(16): Ubiquity\controllers\Controller->loadView('@activeTheme/ma...')
#2 /vendor/phpmv/ubiquity/src/Ubiquity/controllers/Startup.php(143): controllers\ControllerBase->initialize()
#3 /vendor/phpmv/ubiquity/src/Ubiquity/controllers/Startup.php(30): Ubiquity\controllers\Startup::runAction(Array, true, true)
#4 /vendor/phpmv/ubiquity/src/Ubiquity/controllers/Startup.php(98): Ubiquity\control in /vendor/phpmv/ubiquity/src/Ubiquity/views/View.php on line 75

Versions

· PHP 7.1.27-1+ubuntu18.04.1+deb.sury.org+1
· Ubiquity devtools (1.2.3)
· Ubiquity 2.1.2

[ORM] multi models uQuery error

These are the business rules:

  • I have some projects that are created by developers (owners).
  • These projects are divided into stories, each assigned to a developer

This corresponds to the following UML diagram:
image

I want to get the list of projects linked to a developer:

  • either because they are the creator (owner)
  • or because they participate in one of his stories

Steps

I can get the result in 2 times:

The created projects

	public function created($dev='Evan YOU'){
		$projects=DAO::uGetAll(Project::class,'developer.identity= ?',false, [$dev]);
		$this->loadDefaultView(compact('projects','dev'));
	}

image

The projects in which the developer is participating

	public function created($dev='Evan YOU'){
		$projects=DAO::uGetAll(Project::class,'storys.developer.identity= ?',false, [$dev]);
		$this->loadDefaultView(compact('projects','dev'));
	}

image

But if I try to get the result in a single query:

	public function allParticipations($dev='Evan YOU'){
		$projects=DAO::uGetAll(Project::class,'developer.identity= ? OR storys.developer.identity= ?',false,[$dev,$dev]);
		$this->loadDefaultView(compact('projects','dev'));
	}

Actual Result

I get the following error:

Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'storys.Developer_P5d4315266036b.identity' in 'where clause' in \vendor\phpmv\ubiquity\src\Ubiquity\db\traits\DatabaseOperationsTrait.php on line 79

Expected Result

image

Versions

  • Ubiquity framework 2.3.0
  • Ubiquity devtools 1.2.8

[webtools][models] no file found in app/models folder

Steps

I am getting error on Ubiquity Admin, Admin/Model section

Ekran Resmi 2019-04-28 00 39 41

but i have this folder

Ekran Resmi 2019-04-28 00 40 15

Maybe need to separate paths, ROOT with APP_ROOT inside index.php file

ROOT must be document root
APP_ROOT must be application root

Expected Result

Must find it

Actual Result

Couldn't find it

Versions

  • Ubiquity framework 2.1.2
  • Ubiquity devtools 1.2.3
  • php 7.3.4
  • Macos 10.14.4

[part] ORM Table annotation

Steps

  1. Created a table pessoas in MySQL (lower case name)
  2. Created a model named Pessoas with web-tools
  3. Set @table("pessoas") annotation in model Pessoas
  4. Run cache tool on web-tools

Expected Result

Succefull message

Actual Result

Message : Uncaught mindplay\annotations\AnnotationException: Ubiquity\annotations\TableAnnotation::$0 is not a valid property name in C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\Annotation.php:29 Stack trace: #0 C:\wamp64\www\ubiquity\html\vendor\phpmv\ubiquity\src\Ubiquity\annotations\BaseAnnotation.php(41): mindplay\annotations\Annotation->__get('0') #1 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\AnnotationManager.php(296): Ubiquity\annotations\BaseAnnotation->initAnnotation(Array) #2 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\AnnotationManager.php(263): mindplay\annotations\AnnotationManager->getAnnotations('models\\Pessoas', 'class') #3 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\AnnotationManager.php(594): mindplay\annotations\AnnotationManager->getAnnotations('models\\Pessoas', 'property', '$id') #4 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\Annotations.php(90): mindplay\an
File : C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\Annotation.php
Line : 29

Versions

  • Ubiquity framework 2.0.11
  • Ubiquity devtools 1.1.6
  • php 7.1.9
  • Windows 10 (wamp 3.5)

Pessoas model

<?php
namespace controllers;

use Ubiquity\orm\DAO;

/**
 * Controller Pessoas
 **/
class Pessoas extends ControllerBase
{

[RFC] DateTime fields be DateTime objects

Summary

All the database fields mapped as Date / DateTime / Timestamp be converted to PHP DateTime object and all set also require this fields to be a DateTime object

Motivation

This will take advantage of Localizations, native PHP functions and padronize the variables

Compatibility with Ubiquity's philosophy

Indicate compatibility or improvements in:

  • performances
  • ease of use
  • standards and padronization

Expected results

A clear and precise use of datetime database fields.

[Startup] File not found generates an exception

Steps

Navigate to an inexisting Url
http://127.0.0.1:8090/notExists

Expected Result

a 404 not found error

Actual Result

Fatal error: Uncaught Error: Call to a member function header() on null in ...\vendor\phpmv\ubiquity\src\Ubiquity\controllers\Startup.php on line 32

Versions

  • Ubiquity framework 2.1.3
  • Ubiquity devtools 1.2.4
  • php 7.2.3
  • OS : all

[Rest] Update an object with manyToOne members generates an error 500

Steps

Model class:

class User{
	/**
	 * @id
	 * @column("name"=>"id","nullable"=>false,"dbType"=>"int(11)")
	 * @validator("id","constraints"=>array("autoinc"=>true))
	**/
	private $id;

	/**
	 * @column("name"=>"firstname","nullable"=>false,"dbType"=>"varchar(65)")
	 * @validator("length","constraints"=>array("max"=>65,"notNull"=>true))
	**/
	private $firstname;

	/**
	 * @column("name"=>"lastname","nullable"=>false,"dbType"=>"varchar(65)")
	 * @validator("length","constraints"=>array("max"=>65,"notNull"=>true))
	**/
	private $lastname;

	/**
	 * @manyToOne
	 * @joinColumn("className"=>"models\\Organization","name"=>"idOrganization","nullable"=>false)
	**/
	private $organization;
}

Rest controller:

namespace controllers;

/**
 * Rest Controller RestUsers
 * @route("/rest/users","inherited"=>true,"automated"=>true)
 * @rest("resource"=>"models\\User")
 */
class RestUsers extends \Ubiquity\controllers\rest\RestController {

}

Tested request:
image

image

Expected Result

image

Actual Result

image

Versions

  • Ubiquity framework 2.1.1
  • Ubiquity devtools 1.2.3
  • php 7.2.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.