So after a bit of struggle to get the authentication working with graph.microsoft.com i can now read the sharepoint sites and lists.
I can also read the drives and i managed to create a folder and file in the teamsite with REST calls, go me!. The problem is that although i can "create a file" and it shows up on my.sharepoint.com it has 0 content length.
I used this page to guide me through it: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/listitem_create
The code i used to create a file is as follows
$currentFile = new File($file);
$contents = $currentFile->read();
$currentFile->close();
$url = 'https://graph.microsoft.com/beta/sharePoint/site/drives/'.$this->driveId.'/'.$location.'/items/'.$parent_id.'/children';
$tempData = $this->Controller->Temp->read('Office');
$headers = array('Authorization' => 'Bearer '.$tempData['token']['access_token'], 'Content-Type' => 'application/json');
$data = json_encode(array('name' => basename($file), 'file' => new stdClass()));
$sckt = new HttpSocket(array('ssl_verify_host' => false));
$apiData = $sckt->post($url, $data, array('header' => $headers));
You are right to see i am not sending the $contents var allong with the json request because this will break the request. And i started doing some digging around and saw that in the OneDrive section the file contents is send as a binary formatted string through json
So i tried putting 'content' => $blob (i am guesing im supposed to use content here) in the json array, but i just get "malformed request". I also tried to post as text/plain but it only accepts json requests. Form/multipart also didn't work so i've been trying al sorts of options and array keys but nothing seems to get my file contents to sharepoint.
I also tried the same with "Columnset" (https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/listitem_update).
So in summary: I can now make a file, make a folder, change it, update and create meta data, change the names. But i can't get the file contents uploaded!!!
At the moment i'm hoping it's just something stupid i'm not seeing, so you can laugh at me and give me some awesome advise after you're done laughing ofc. Because i get the feeling it's not something that works in the beta yet which would be kinda weird.