Beginner question

Hi all,

I’m working to create my own app for Nextcloud.
I want to create a Command for occ.
My command is registered in my info.xml


When I call the command I receive a dump of the php file contening the class and the following error.

An unhandled exception has been thrown:
exception ‘Exception’ with message ‘Console command ‘OCA\MyApp\Command\MyCommand’ is unknown and could not be loaded’ in /var/www/clients/client/web/web/lib/private/Console/Application.php:181

I’m using NC 12.0.5. It seems that the ClassLoader can not load my class. The path of the php file is apps/MyApp/lib/Command/Mycommand.php

My php file is like :

namespace OCA\MyApp\Command;

class Mycommand extends Base {

fix … just forgot “php” after <? …

why do you need something in info.xml?

you only need an appinfo/register_command if I am not wrong

Based on the files_frommail project (, only a declaration in info.xml is requiered to register a command.

That’s my app ! I am proud you’re using it as an example :wink:

1 Like