I would recommend looking at and playing with some peoples code on GitHub that helped me a lot then once you think you have a pretty decent understanding of the API read the pocketmine src
alternatively if you wanna read whole config file PHP: $myconfig = fopen("plugins/dir/config.yml", "w") or die("Unable to open file!");
Throwing exceptions is better than die() in plugins. You don't want to destroy other plugins just because your own plugin doesn't work. Moreover, die() would probably not kill other threads.