<?php
$user = [
'id' => 1,
'name' => 'Ivan Ivanov',
'role' => 'developer',
'salary' => 100
];
$apiTemplatesSet1 = [
'/api/items/%id%/%name%',
'/api/items/%id%/%role%',
'/api/items/%id%/%salary%'
];
print_r(str_replace(array_keys($user), array_values($user), str_replace("%", "", $apiTemplatesSet1)));
Array
(
[0] => /api/items/1/Ivan Ivanov
[1] => /api/items/1/developer
[2] => /api/items/1/100
)
можно просто в начале файла сделать 100 reqire_once()