PHP code example of romb2on / romb2on-frappe
1. Go to this page and download the library: Download romb2on/romb2on-frappe library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
romb2on / romb2on-frappe example snippets
return [
'frappe_url' => env('FRAPPE_URL', null),
'frappe_api_key' => env('FRAPPE_API_KEY', null),
'frappe_api_secret' => env('FRAPPE_API_SECRET', null),
'frappe_username' => env('FRAPPE_USERNAME', null),
'frappe_password' => env('FRAPPE_PASSWORD', null),
];
//getUser
$frappe = new Romb2on\Frappe\Frappe();
$res=$frappe->getUser('[email protected] ');
//update user
$res=$frappe->doctype()->update('User','[email protected] ',[
'first_name'=>'Jurin'
]);
//create data
$res=$frappe->doctype()->create('Error Log',[
'method'=>'test error',
'error'=>'hello world'
]);
//delete record
$res=$frappe->doctype()->delete('Error Log','234460');
//get all data
$res=$frappe->doctype()->getAll('User',[
'filters'=>'[["user_type","=","System User"]]'
]);
//get single doctype
$res=$frappe->doctype()->getDoc('DocType','About Us Settings');
//using mount
$res=$frappe->doctype()
->mount('DocType')
->orderBy("name, creation asc")
->fields('["name","creation"]')
->paginate(1,10)
->get();
bash
php artisan vendor:publish --tag="romb2on-frappe-config"