You could use the preg_split
function to divide your chain into as many parts as there are points in your chain. As you are going to get an array and the name of your application is going to be last, you can always take the last position - 1 (remember that arrays always start at position 0).
In this way, you should not worry about how many points there are ahead of the name of your app since you will always get the last String of the string, which will correspond to the name of your application.
Example:
<?php
$string = "paqueteNombre.appNombre";
$array = preg_split("/[.]/", $string);
echo $array[count($array) - 1]; //appNombre
$string2 = "cualquiercosa.otracosa.paqueteNombre.appNombre2";
$array2 = preg_split("/[.]/", $string2);
echo $array2[count($array2) - 1]; //appNombre2