I'm developing a tool, however I'm looking for the best solution to encode the php source code so no one can decode it, is that even possible?

If not, is it a good practice to create an api, so almost the whole process part is on my server and if someone doesn't have the token, cannot use the tool. Is that a good practice?