Use RouteXL to obtain by PHP the optimization by text reply
We have an API fo programmatic access:
https://www.routexl.nl/blog/api/
Here is some sample PHP code:
https://github.com/routexl/RouteXL-API-Connector
The API is free for routes with up to 10 stops. Upgrade your account for more stops per route. Addresses should be coordinates, so you’ll need to geocode to coordinates yourself. There are several services on the web for that.