# Plugins Plugins were created to keep the app maintainable while still making it possible to easily implement additional functionality. There are essentially three different use cases for plugins: * Creating or extending server-side functionality, e.g. creating additional REST API endpoints * Offering article actions such as share via Twitter or E-Mail * Dropping in additional CSS or JavaScript ## The Basics Whatever plugin you want to create, you first need to create a basic structure. A plugin is basically just an app, so you can take advantage of the full [Nextcloud app API](https://docs.nextcloud.org/server/latest/developer_manual/app/index.html). [Take a look at the developer docs](https://docs.nextcloud.com/server/latest/developer_manual/app_development/index.html) or [dig into the tutorial](https://docs.nextcloud.com/server/latest/developer_manual/app_development/tutorial.html). However, if you just want to start slow, the full process is described below. First create a skeleton app using the [web interface](https://apps.nextcloud.com/developer/apps/generate) The application name affects the name and namespace of your plugin and only one app can exist using the same name. Choose wisely. This will become the directory name in the Nextcloud `apps/` directory * **newsplugin/** * **appinfo/** * **app.php** * **info.xml** **Note**: You must license your app under the [AGPL 3 or later](https://www.gnu.org/licenses/agpl-3.0.en.html) to comply with the News app's license. Don't forget to add the license as plain text file if you want to distribute your app! Then we want to make sure that our code is only run if the News app is enabled. To do that put the following PHP code into the **newsplugin/lib/AppInfo/Application.php** file: ```php getContainer(); $container->registerService('NewsContainer', function($c) { $app = new News(); return $app->getContainer(); }); $container->registerService(OCA\News\Service\FeedService::class, function($c) { // use the feed service from the news app, you can use all // defined classes but its recommended that you stick to the // mapper and service classes since they are less likely to change return $c->query('NewsContainer')->query(OCA\News\Service\FeedService::class); }); } } ``` Using automatic container assembly you can then use it from your code by simply adding the type to your constructors. # TODO: Update the following If your plugin integrates with another Nextcloud app, make sure to also require it be installed. If you depend on the Bookmarks app for instance use: ```php ') .addClass('article-plugin-twitter'); var $button = $('