Hi there!
I’m a rookie and I would like to develop Nextcloud apps. I have a question regarding my dev environment. I setup a Nextcloud in Windows Subsystem for Linux (WSL) and use PHPStorm on Windows.
I checked out the notestutorial and opened the project in PHPStorm. When I open any class PHPStorm can’t find the OCP package. E.g. in the NoteApiController.php class PHPStorm cant find
use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
How do I configure my dev environment/PHPStorm to get auto completion for the Nextcloud classes?
Thanks in advance!
Hey,
to develop apps for Nextcloud a instance of https://github.com/nextcloud/server/ is required. Setup the server first and then place your app inside apps/. https://github.com/juliushaertl/nextcloud-docker-dev is a docker-compose script to help you with the setup.
For CI/CD there is package available: https://packagist.org/packages/christophwurst/nextcloud_testing.
So do I have to open the whole /var/www/nextcloud folder as project in PHPStorm?
Yes.
Also, after you checkout nextcloud/server run git submodule update --init
inside it to download 3d party libraries.
no, you can add the server repository path in the PHP include path config in the PHPStorm settings.
1 Like
Ok what I did now is:
- Clone the nextcloud server repo on my windows
- Clone the notes tutorial into nextcloud/apps
- In Ubuntu WSL goto /var/www and create symlinc to the nextcloud repo
ln -s /mnt/c/path/to/nextcloud/repo nextcloud
- follow the dev env doku and the notes tutorial doku to install dependencies and do configuration
- open the nextcloud repo in PHPStorm on my windows machine
Seems to work for now. Thanks guys!
1 Like
I didn’t think of this, but honestly, I like to have the entire Nextcloud “close” and searchable by the IDE so that I can compensate for the lack of documentation and search the code quickly
Right, that was my old trick with Netbeans as well where I could open multiple projects inside a single window. Ever since switching to phpstorm I just open Nextcloud as a whole.