title: How to use a php restful api-centric design internal instead of with http request
body: <p>I want to create a php restful api-centric web application/website where I have the data/api that gets called from my front end code. Besides making HTTP/curl request calls each time I load a page, what can I do for internal API calls using frameworks like slim?</p>
  
  <p>I'm not sure of a way to include the api for internal use in my front end code and still keep it apart. </p>
  
  <p>My thoughts was something like this:</p>
  
  <pre><code>"example.com/api/story/todays-weather/"
  pulls in the json formatted story with a http request with curl or Ajax
  </code></pre>
  
  <p>But instead could I do something like:</p>
  
  <pre><code>require("/api/internal.php");
  $uri = "/story/todays-weather/";
  $call = api::getStory($uri);
  $result = json_decode($call);
  .....
  </code></pre>
  
  <p>Am I headed in the right direction or am I way off?</p>
  
  <p>The api and front code are on the same cloud box (Amazon E2/LAMP) and I am planing on using memcached for the api. </p>