# Best Way To Familiarize With DF

**URL:** <https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858>\
**Category:** Server-Side Scripting\
**Created:** [November 30, 2015, 2:18am UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858 "2015-11-30T02:18:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdubya152](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/rdubya152/32/492_2.png) [@rdubya152](https://community.dreamfactory.com/u/rdubya152)\
**Post date:** [November 30, 2015, 2:18am UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/1 "2015-11-30T02:18:42Z")

</div>

Anyone have any suggested methods for really familiarizing oneself with the scripting docs? Specifically, the PHP scripts.

I know the engineers are working on the documentation for DF 2.0, but I’m just wondering where the best place to learn the methods, functions, etc… that I can call within a script. Where should I look within the install directory to gain more insight into the available methods?

For example, I am trying to call something like “platform.api.get()” using PHP, but it doesn’t seem to work so I’m trying to figure out how to use the following code from the PHP scripting example to create an internal GET request from within a custom script to download a file:

DreamFactory\Core\Utility\ServiceHandler::handleRequest(  
‘POST’,  
‘push’,  
‘topic/arn:aws:sns:us-east-1:xxxxxx:new\_todo’,  
[],  
[  
“Message” =\> “A new Todo named “.$payload[‘name’].” was just created.”,  
“Subject” =\> “New Todo Created”,  
]  
);  
(obviously I need to modify that code)

I’m trying to basically make a custom pre\_process script for my file storage service which changes the inbound URL request. It seems the pre/post processing server scripts do not fire for some reason currently. Someone else reported this issue, but I can’t find the link ATM. Like the user who reported the issue, I’m trying to take an inbound folder request and internally modify the link to their folder.

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [December 1, 2015, 3:51pm UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/2 "2015-12-01T15:51:39Z")

</div>

Unlike with JavaScript we don’t have all those classes pre-built.  
Here is a sample PHP script for interacting with the API that one of the engineers sent me. Hopefully it’s enough to get you going.

```
use \DreamFactory\Core\Utility\ServiceHandler;
use \DreamFactory\Core\Enums\DataFormats;

$verb = \Request::method();
$service = \Request::input('service');
$resource = \Request::input('resource');
$urlQuery = \Request::query();
$postedPayload = \Request::json()->all();
$format = DataFormats::JSON;
$headers = \Request::header();

// uncomment for debugging
//return [
// 'verb' => $verb,
// 'service' => $service,
// 'resource' => $resource,
// 'query' => $urlQuery,
// 'payload' => $postedPayload,
// 'format' => $format,
// 'headers' => $headers
//];

return ServiceHandler::handleRequest($verb, $service, $resource, $urlQuery, $postedPayload, $format, $headers);
```

---

<div class="post-metadata">

**Author:** ![kimpatro](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/kimpatro/32/467_2.png) [@kimpatro](https://community.dreamfactory.com/u/kimpatro)\
**Post date:** [December 2, 2015, 11:27am UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/3 "2015-12-02T11:27:54Z")

</div>

Just to remind that the documentation will be released in dec, 20.

=D

---

<div class="post-metadata">

**Author:** ![rdubya152](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/rdubya152/32/492_2.png) [@rdubya152](https://community.dreamfactory.com/u/rdubya152)\
**Post date:** [December 5, 2015, 12:54am UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/4 "2015-12-05T00:54:23Z")

</div>

Thanks @formerstaff and @kimpatro, those pieces of information will both be very helpful.

Looking forward to a Dec. 20 docs release!

---

<div class="post-metadata">

**Author:** ![rdubya152](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/rdubya152/32/492_2.png) [@rdubya152](https://community.dreamfactory.com/u/rdubya152)\
**Post date:** [December 5, 2015, 3:57am UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/5 "2015-12-05T03:57:39Z")

</div>

@formerstaff is there a way to access the user object with php? like [user.id](http://user.id)?

EDIT:  
Got it, ya’ll. To access a user’s info in a custom script do this:

$userInfo = ServiceHandler::handleRequest(‘GET’,‘user’,‘session’,[],[]);

Follows the paradigm Drew left us above.

‘session’ can be replaced with whatever other resource (like ‘custom’, or ‘profile’, or left blank).

Now trying to figure out how to access a user’s custom lookup key…

EDIT 2: Found out how to get a user’s custom lookup key:

/system/user/4?related=user\_lookup\_by\_user\_id

system user and related are the answer here - i think

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [December 7, 2015, 12:56pm UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/6 "2015-12-07T12:56:38Z")

</div>

That look right, to the best of my knowledge. I’m still getting up to speed on the PHP scripting.

---

<div class="post-metadata">

**Author:** ![ramnew2006](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/ramnew2006/32/580_2.png) [@ramnew2006](https://community.dreamfactory.com/u/ramnew2006)\
**Post date:** [January 28, 2016, 9:03am UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/7 "2016-01-28T09:03:37Z")

</div>

Hey Kim, any idea when the documentation related to PHP scripting will be up on the website. There are few examples on the documentation but that isn’t fully useful if we have to write a complex PHP script.

---

<div class="post-metadata">

**Author:** ![kimpatro](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/kimpatro/32/467_2.png) [@kimpatro](https://community.dreamfactory.com/u/kimpatro)\
**Post date:** [January 28, 2016, 11:58am UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/8 "2016-01-28T11:58:30Z")

</div>

Hi,

I don’t know what you want to do, but there’s this documentation: [https://wiki.dreamfactory.com/DreamFactory/Tutorials#PHP](https://wiki.dreamfactory.com/DreamFactory/Tutorials#PHP)

Maybe @formerstaff could give you more information.

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [January 28, 2016, 8:25pm UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/9 "2016-01-28T20:25:32Z")

</div>

No updates right now. The dev team is working on getting 2.1 out the door.

---

<div class="post-metadata">

**Author:** ![mharvey](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/mharvey/32/590_2.png) [@mharvey](https://community.dreamfactory.com/u/mharvey)\
**Post date:** [February 17, 2016, 11:13am UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/10 "2016-02-17T11:13:01Z")

</div>

This is helpful. I’m trying to use this to retrieve all records from a table on a post post using:  
`$csvInfo = DreamFactory\Core\Utility\ServiceHandler::handleRequest('GET','mysql','_table/saa-recipients'); var_dump($csvInfo);`

It’s only returning the record I just submitted via POST and not all records. This is sort of useless as my post data is available as **\Request::json()-\>all();**

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [March 2, 2016, 3:49pm UTC](https://community.dreamfactory.com/t/best-way-to-familiarize-with-df/1858/12 "2016-03-02T15:49:08Z")

</div>

PHP Scripting tutorials have been added/updated since this topic started. [https://wiki.dreamfactory.com/DreamFactory/Tutorials#Scripting](https://wiki.dreamfactory.com/DreamFactory/Tutorials#Scripting)
