Save it. Now create a folder named widget-plugin, put the newly created php file into the folder. Upload the folder in your wp-content/plugins folder in your CPanel.
Voila! you successfully created a simple plugin. To make sure that you successfully created the plugin, go to your administration area > plugins. If your plugin appears in the plugins list you’re good, otherwise make sure you followed my instructions and try again. You can now activate the plugin.