54 if (\count($this->aliases) > 0) {
55 $result .=
"\n" . $dec .
"· Aliases :";
57 array_walk(
$aliases,
function (&$alias) {
58 $alias =
"<b>" . $alias .
"</b>";
60 $result .=
" " . implode(
",",
$aliases);
62 if (\count($this->parameters) > 0) {
63 $result .=
"\n" . $dec .
"· Parameters :";
64 foreach ($this->parameters as $param => $content) {
65 $result .=
"\n" . $dec .
"\t<b>-" . $param .
"</b>";
66 $result .= $content .
"\n";
69 if (\count($this->examples) > 0) {
70 $result .=
"\n" . $dec .
"<b>× Samples :</b>";
71 foreach ($this->examples as $desc => $sample) {
72 if (is_string($desc)) {
85 foreach ($commands as $command) {
86 if ($command->getName() == $cmd) {
89 "info" =>
"Command <b>{$cmd}</b> find by name",
93 } elseif (\array_search($cmd, $command->getAliases()) !==
false) {
95 "info" =>
"Command <b>{$cmd}</b> find by alias",
98 } elseif (\stripos($command->getDescription(), $cmd) !==
false) {
100 "info" =>
"Command <b>{$cmd}</b> find in description",
106 if ($cmd == $parameter->getName()) {
108 "info" =>
"Command <b>{$cmd}</b> find by the name of a parameter",
112 if (\stripos($parameter->getDescription(), $cmd) !==
false) {
114 "info" =>
"Command <b>{$cmd}</b> find in parameter description",
126 return new Command(
"project",
"projectName",
"Creates a new #ubiquity project.", [
131 "s" =>
Parameter::create(
"serverName",
"Defines the db server address.", [],
"127.0.0.1"),
140 "m" =>
Parameter::create(
"all-models",
"Creates all models from database.", [],
""),
148 'Creates a new project' =>
'Ubiquity new blog',
149 'With admin interface' =>
'Ubiquity new blog -a',
150 'and models generation' =>
'Ubiquity new blog -a -m -b=blogDB'
155 return new Command(
"controller",
"controllerName",
"Creates a new controller.", [
161 "v" =>
Parameter::create(
"views",
"creates an associated view folder and index.html", [
165 'o' =>
Parameter::create(
'domain',
'The domain in which to create the controller.', [],
'')
167 'Creates a controller' =>
'Ubiquity controller UserController',
168 'with its associated view' =>
'Ubiquity controller UserController -v',
169 'Creates a controller in the orga domain' =>
'Ubiquity controller OrgaController -o=orga'
174 return new Command(
"genModel",
"tableName",
"Generates a new model from an existing table.", [
180 'd' =>
Parameter::create(
'database',
'The database connection to use', [],
'default'),
181 'a' =>
Parameter::create(
'access',
'The default access to the class members', [],
'private'),
182 'o' =>
Parameter::create(
'domain',
'The domain in which to create the model.', [],
'')
184 'Ubiquity genModel User',
185 'Ubiquity genModel Author -d=projects',
186 'Ubiquity genModel Author -d=projects -a=protected'
191 return new Command(
"model",
"modelName",
"Generates models from scratch.", [
201 'd' =>
Parameter::create(
'database',
'The database connection to use', [],
'default'),
202 'o' =>
Parameter::create(
'domain',
'The domain in which to create the model.', [],
''),
203 'k' =>
Parameter::create(
'autoincPk',
'The default primary key defined as autoinc.', [],
'id')
205 'Ubiquity model User',
206 'Ubiquity model Author -d=projects',
207 'Ubiquity model Group,User -o=orga'
212 return new Command(
"info-routes",
"",
"Display the cached routes.", [
223 "l" =>
Parameter::create(
"limit",
" Specifies the number of routes to return.", []),
224 "o" =>
Parameter::create(
"offset",
"Specifies the number of routes to skip before starting to return.", []),
225 "s" =>
Parameter::create(
"search",
"Search routes corresponding to a path.", []),
226 "m" =>
Parameter::create(
"method",
"Allows to specify a method with search attribute.", [
234 'All routes' =>
'Ubiquity info:routes',
235 'Rest routes' =>
'Ubiquity info:routes -type=rest',
236 'Only the routes with the method post' =>
'Ubiquity info:routes -type=rest -m=-post'
241 return new Command(
"version",
"",
"Return PHP, Framework and dev-tools versions.", [], [], [],
'system');
245 return new Command(
"all-models",
"",
"Generates all models from database.", [
251 'd' =>
Parameter::create(
'database',
'The database connection to use (offset)', [],
'default'),
252 'a' =>
Parameter::create(
'access',
'The default access to the class members', [],
'private'),
253 'o' =>
Parameter::create(
'domain',
'The domain in which to create the models.', [],
'')
255 'Ubiquity all-models',
256 'Ubiquity all-models -d=projects',
257 'Ubiquity all-models -d=projects -a=protected'
262 return new Command(
"clear-cache",
"",
"Clear models cache.", [
277 'Clear all caches' =>
'Ubiquity clear-cache -t=all',
278 'Clear models cache' =>
'Ubiquity clear-cache -t=models'
283 return new Command(
"init-cache",
"",
"Init the cache for models, router, rest.", [
296 'Init all caches' =>
'Ubiquity init-cache',
297 'Init models cache' =>
'Ubiquity init-cache -t=models'
302 return new Command(
"serve",
"",
"Start a web server.", [], [
306 "l" =>
Parameter::create(
"lrport",
"Sets the live-reload listen port number.", [],
'35729'),
314 'Starts a php server at 127.0.0.1:8090' =>
'Ubiquity serve',
315 'Starts a reactPHP server at 127.0.0.1:8080' =>
'Ubiquity serve -t=react'
320 return new Command(
"livereload",
"path",
"Start the live reload server.", [
325 "e" =>
Parameter::create(
"exts",
"Specify extentions to observe .", [],
'php,html'),
326 "x" =>
Parameter::create(
"exclusions",
"Exclude file matching pattern .", [],
'cache/,logs/')
328 'Starts the live-reload server at 127.0.0.1:35729' =>
'Ubiquity live-reload',
329 'Starts the live-reload server at 127.0.0.1:35800 excluding logs directory' =>
'Ubiquity live-reload -p=35800 -x=logs/'
334 return new Command(
"self-update",
"",
"Updates Ubiquity framework for the current project.", [], [], [],
'installation');
338 return new Command(
"admin",
"",
"Add UbiquityMyAdmin webtools to the current project.", [], [], [],
'installation');
341 public static function help() {
342 return new Command(
"help",
"?",
"Get some help about a dev-tools command.", [], [], [
343 'Get some help about crud' =>
'Ubiquity help crud'
348 return new Command(
"crud",
"crudControllerName",
"Creates a new CRUD controller.", [
371 ],
"index,form,display"),
373 'o' =>
Parameter::create(
'domain',
'The domain in which to create the controller.', [],
'')
375 'Creates a crud controller for the class models\User' =>
'Ubiquity crud CrudUsers -r=User',
376 'and associates a route to it' =>
'Ubiquity crud CrudUsers -r=User -p=/users',
377 'allows customization of index and form templates' =>
'Ubiquity crud CrudUsers -r=User -t=index,form',
378 'Creates a crud controller for the class models\projects\Author' =>
'Ubiquity crud Authors -r=models\projects\Author'
383 return new Command(
"crud-index",
"crudControllerName",
"Creates a new index-CRUD controller.", [
384 'crud-index-controller',
407 ],
"index,form,display,home,itemHome"),
409 'o' =>
Parameter::create(
'domain',
'The domain in which to create the controller.', [],
'')
411 'Creates an index crud controller' =>
'Ubiquity crud-index MainCrud -p=crud/{resource}',
412 'allows customization of index and form templates' =>
'Ubiquity index-crud MainCrud -t=index,form'
417 return new Command(
"rest",
"restControllerName",
"Creates a new REST controller.", [
425 'o' =>
Parameter::create(
'domain',
'The domain in which to create the controller.', [],
'')
427 'Creates a REST controller for the class models\User' =>
'Ubiquity rest RestUsers -r=User -p=/rest/users'
432 return new Command(
"restapi",
"restControllerName",
"Creates a new REST API controller.", [
433 'restapi-controller',
434 'restapi:controller',
435 'restapi_controller',
439 'o' =>
Parameter::create(
'domain',
'The domain in which to create the controller.', [],
'')
441 'Creates a REST API controller' =>
'Ubiquity restapi -p=/rest'
445 public static function dao() {
446 return new Command(
"dao",
"command",
"Executes a DAO command (getAll,getOne,count,uGetAll,uGetOne,uCount).", [
451 "i" =>
Parameter::create(
"included",
"The associated members to load (boolean or array: client.*,commands)", []),
452 "p" =>
Parameter::create(
"parameters",
"The parameters for a parameterized query", []),
454 'o' =>
Parameter::create(
'domain',
'The domain in which the models are.', [],
'')
456 'Returns all instances of models\User' =>
'Ubiquity dao getAll -r=User',
457 'Returns all instances of models\User and includes their commands' =>
'Ubiquity dao getAll -r=User -i=commands',
458 'Returns the User with the id 5' =>
'Ubiquity dao getOne -c="id=5"-r=User',
459 'Returns the list of users belonging to the "Brittany" or "Normandy" regions' =>
'Ubiquity uGetAll -r=User -c="region.name= ? or region.name= ?" -p=Brittany,Normandy'
464 return new Command(
"auth",
"authControllerName",
"Creates a new controller for authentification.", [
470 "e" =>
Parameter::create(
"extends",
"The base class of the controller (must derived from AuthController)", [],
"Ubiquity\\controllers\\auth\\AuthController"),
478 ],
'index,info,noAccess,disconnected,message,baseTemplate'),
480 'o' =>
Parameter::create(
'domain',
'The domain in which to create the controller.', [],
'')
482 'Creates a new controller for authentification' =>
'Ubiquity auth AdminAuthController',
483 'and associates a route to it' =>
'Ubiquity auth AdminAuthController -p=/admin/auth',
484 'allows customization of index and info templates' =>
'Ubiquity auth AdminAuthController -t=index,info'
489 return new Command(
"action",
"controller.action",
"Creates a new action in a controller.", [
501 'o' =>
Parameter::create(
'domain',
'The domain in which the controller is.', [],
'')
503 'Adds the action all in controller Users' =>
'Ubiquity action Users.all',
504 'Adds the action display in controller Users with a parameter' =>
'Ubiquity action Users.display -p=idUser',
505 'and associates a route to it' =>
'Ubiquity action Users.display -p=idUser -r=/users/display/{idUser}',
506 'with multiple parameters' =>
'Ubiquity action Users.search -p=name,address',
507 'and create the associated view' =>
'Ubiquity action Users.search -p=name,address -v'
512 return new Command(
'domain',
'name',
'Creates a new domain (for a Domain Driven Design approach).', [
520 'Creates a new domain users' =>
'Ubiquity domain users'
525 return new Command(
"info-model",
"?infoType",
"Returns the model meta datas.", [
530 "s" =>
Parameter::create(
"separate",
"If true, returns each info in a separate table", [
534 "m" =>
Parameter::create(
"model",
"The model on which the information is sought.", []),
538 'Gets metadatas for User class' =>
'Ubiquity info:model -m=User'
543 return new Command(
'info-models',
'',
'Returns the models meta datas.', [
548 'd' =>
Parameter::create(
'database',
'The database connection to use (offset)', [],
'default'),
549 "m" =>
Parameter::create(
"models",
"The models on which the information is sought.", []),
551 'o' =>
Parameter::create(
'domain',
'The domain in which the models are.', [],
'')
553 'Gets metadatas for all models in default db' =>
'Ubiquity info:models',
554 'Gets metadatas for all models in messagerie db' =>
'Ubiquity info:models -d=messagerie',
555 'Gets metadatas for User and Group models' =>
'Ubiquity info:models -m=User,Group',
556 'Gets all primary keys for all models' =>
'Ubiquity info:models -f=#primaryKeys'
561 return new Command(
"info-validation",
"?memberName",
"Returns the models validation info.", [
570 "s" =>
Parameter::create(
"separate",
"If true, returns each info in a separate table", [
574 "m" =>
Parameter::create(
"model",
"The model on which the information is sought.", []),
577 'Gets validators for User class' =>
'Ubiquity info:validation -m=User',
578 'Gets validators for User class on member firstname' =>
'Ubiquity info:validation firstname -m=User'
583 return new Command(
"config",
"",
"Returns the config informations from app/config/config.php.", [
591 'Display all config vars' =>
'Ubiquity config',
592 'Display database config vars' =>
'Ubiquity config -f=database'
597 return new Command(
"config-set",
"",
"Modify/add variables and save them in app/config/config.php. Supports only long parameters with --.", [
603 'Assigns a new value to siteURL' =>
'Ubiquity config:set --siteURL=http://127.0.0.1/quick-start/',
604 'Change the database name and port' =>
'Ubiquity config:set --database.dbName=blog --database.port=3307'
609 return new Command(
"create-theme",
"themeName",
"Creates a new theme or installs an existing one.", [
614 "x" =>
Parameter::create(
"extend",
"If specified, inherits from an existing theme (bootstrap,semantic or foundation).", [
619 'o' =>
Parameter::create(
'domain',
'The domain in which to create the theme.', [],
'')
621 'Creates a new theme custom' =>
'Ubiquity create-theme custom',
622 'Creates a new theme inheriting from Bootstrap' =>
'Ubiquity theme myBootstrap -x=bootstrap'
627 return new Command(
"theme",
"themeName",
"Installs an existing theme or creates a new one if the specified theme does not exists.", [
633 'o' =>
Parameter::create(
'domain',
'The domain in which to install the theme.', [],
'')
635 'Creates a new theme custom' =>
'Ubiquity theme custom',
636 'Install bootstrap theme' =>
'Ubiquity theme bootstrap'
641 return new Command(
"bootstrap",
"command",
"Executes a command created in app/config/_bootstrap.php file for bootstraping the app.", [
644 'Bootstrap for dev mode' =>
'Ubiquity bootstrap dev',
645 'Bootstrap for prod mode' =>
'Ubiquity bootstrap prod'
650 return new Command(
"composer",
"command",
"Executes a composer command.", [
653 'composer update' =>
'Ubiquity composer update',
654 'composer update with no-dev' =>
'Ubiquity composer nodev',
655 'composer optimization for production' =>
'Ubiquity composer optimize'
660 return new Command(
"mailer",
"part",
"Displays mailer classes, mailer queue or mailer dequeue.", [], [], [
661 'Display mailer classes' =>
'Ubiquity mailer classes',
662 'Display mailer messages in queue(To send)' =>
'Ubiquity mailer queue',
663 'Display mailer messages in dequeue(sent)' =>
'Ubiquity mailer dequeue'
668 return new Command(
"send-mail",
"",
"Send message(s) from queue.", [
674 "n" =>
Parameter::create(
"num",
"If specified, Send the mail at the position n in queue.", [])
676 'Send all messages to send from queue' =>
'Ubiquity semdMails',
677 'Send the first message in queue' =>
'Ubiquity sendMail 1'
682 return new Command(
"new-mail",
"name",
"Creates a new mailer class.", [
687 "p" =>
Parameter::create(
"parent",
"The class parent.", [],
'\\Ubiquity\\mailer\\AbstractMail'),
690 'Creates a new mailer class' =>
'Ubiquity newMail InformationMail'
695 return new Command(
'new-class',
"name",
"Creates a new class.", [
703 'Creates a new class' =>
'Ubiquity class services.OrgaRepository'
708 return new Command(
"create-command",
"commandName",
"Creates a new custom command for the devtools.", [
714 "p" =>
Parameter::create(
"parameters",
"The command parameters (comma separated).", []),
716 "a" =>
Parameter::create(
"aliases",
"The command aliases (comma separated).", [])
718 'Creates a new custom command' =>
'Ubiquity create-command custom'
723 return new Command(
'acl-init',
'',
'Initialize Acls defined with annotations in controllers.', [
729 "p" =>
Parameter::create(
"providers",
"The providers to use (comma separated).", [
'dao'],
'dao'),
732 'Initialize Acls' =>
'Ubiquity aclInit',
733 'Initialize Acls and create tables for AclDAOProvider' =>
'Ubiquity aclInit -p=dao',
734 'Initialize Acls, create tables for acls db offset and models for AclDAOProvider' =>
'Ubiquity aclInit -p=dao -m -d=acls',
739 return new Command(
'acl-display',
'',
'Display Acls defined with annotations in controllers.', [
753 'Display all defined roles with ACL annotations' =>
'Ubiquity aclDisplay role'
758 return new Command(
'new-key',
'cypher',
'Generate a new encryption key using a cipher.', [
763 'Generate a key for AES-128' =>
'Ubiquity new-key 128'
768 return new Command(
"info-migrations",
"",
"Returns the migration infos.", [
774 'o' =>
Parameter::create(
'domain',
'The domain in which the database models are.', [],
'')
776 'Display all migrations for the default database' =>
'Ubiquity info:migrations'
781 return new Command(
"migrations",
"",
"Display and execute the database migrations.", [
786 'o' =>
Parameter::create(
'domain',
'The domain in which the database models are.', [],
'')
788 'Display and execute all migrations for the default database' =>
'Ubiquity migrations'
793 return new Command(
"template-parse",
"",
"Parse a twig template to another template engine.", [
798 "e" =>
Parameter::create(
"engine",
"The destination template engine.", [
'twig',
'latte',
'plates'],
'latte'),
799 "d" =>
Parameter::create(
"destination",
"The destination folder.", [],
'default view folder'),
800 'o' =>
Parameter::create(
'origin',
'The folder where the templates are located.', [],
'default view folder')
802 'Migrate all templates in view folder to Latte template engine' =>
'Ubiquity template-parse'
809 if (is_array($commands)) {
810 foreach ($commands as $o) {
811 $result[] = $o->getCommand();
818 if (\class_exists(\
Ubiquity\utils\base\UIntrospection::class)) {
819 if (! isset(self::$customCommands)) {
821 foreach ($classes as $class) {
823 $cmd = $o->getCommand();
824 self::$customCommands[$cmd->getName()] = $o;
828 self::$customAliases[$alias] = $o;
838 if (\class_exists(\
Ubiquity\utils\base\UIntrospection::class)) {
839 self::$customCommands =
null;
840 self::$customAliases = [];
851 if (\class_exists(\
Ubiquity\utils\base\UIntrospection::class)) {
852 $config[
'cmd-pattern'] ??=
'commands' . \DS .
'*.cmd.php';
854 foreach ($files as $file) {
861 'installation' =>
false,
863 ], $excludedCommands = []) {
866 foreach ($commands as $command) {
867 $cat = $command->getCategory();
868 $commandName = $command->getName();
869 if (! isset($excludedCommands[$commandName]) && ! isset($excludedCategories[$cat])) {
870 $result[] = $commandName;
921 ...self::getCustomCommandInfos()
946 if ($this->value !=
null) {
947 return \ltrim($this->value,
'?');
953 return $this->value !=
null && \substr($this->value, 0, 1) !==
'?';
997 return \count($this->parameters) > 0;
1001 return $this->value !=
null;
File system utilities Ubiquity\utils\base$UFileSystem This class is part of Ubiquity.
static glob_recursive($pattern, $flags=0)
Find recursively pathnames matching a pattern.
Ubiquity\utils\base$UIntrospection This class is part of Ubiquity.
static getChildClasses($baseClass)
Class Configuration \config.