1. Go to this page and download the library: Download turahe/core 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/ */
use Turahe\Core\Facades\Google;
use Turahe\Core\Facades\MsGraph;
// Google Services
Google::calendar()->listEvents();
Google::gmail()->sendMessage($message);
// Microsoft Graph Services
MsGraph::calendar()->getEvents();
MsGraph::mail()->sendMessage($message);
// Currency formatting
echo format_currency(1234.56, 'USD'); // $1,234.56
// Name aliases
echo name_alias('John Doe'); // J. Doe
// Text cleaning
echo clean('<script>alert("xss")</script>'); // alert("xss")
// Acronyms
echo acronym('World Health Organization'); // WHO
// Image URLs
echo imgProxy('https://example.com/image.jpg', 800, 600);
echo imgProxyPreset('https://example.com/image.jpg', 'thumbnail');
// Percentage calculations
echo calculate_percentage(25, 100); // 25.0
// Phone parsing
echo parse_phone('+1-555-123-4567'); // +15551234567
use Turahe\Core\Concerns\HasOrganization;
class User extends Authenticatable
{
use HasOrganization;
// Your model implementation
}
// Usage
$user = User::find(1);
$user->organizations()->attach($organizationId, ['role' => 'MEMBER']);
$user->managedOrganizations; // Organizations where user is admin/owner
use Turahe\Core\Concerns\HasSettings;
class User extends Authenticatable
{
use HasSettings;
// Your model implementation
}
// Usage
$user = User::find(1);
$user->updateSetting('theme', 'dark');
$user->getSetting('theme', 'light'); // Returns 'dark' or default 'light'
$user->allSettings(); // Get all settings
use Turahe\Core\Concerns\HasTaxonomies;
class Post extends Model
{
use HasTaxonomies;
// Your model implementation
}
// Usage
$post = Post::find(1);
$post->taxonomies()->attach($categoryId);
$post->taxonomies; // Get all taxonomies
use Turahe\Core\Concerns\HasTags;
class Post extends Model
{
use HasTags;
// Your model implementation
}
// Usage
$post = Post::find(1);
$post->tags()->attach($tagId);
$post->tags; // Get all tags
use Turahe\Core\Repositories\OrganizationRepository;
$repository = app(OrganizationRepository::class);
// Get all organizations
$organizations = $repository->getOrganizations();
// Get organization by ID
$organization = $repository->getOrganization(1);
// Get organization by name
$organization = $repository->getOrganizationByName('Acme Corp');
// Create organization
$organization = $repository->createOrganization([
'name' => 'New Organization',
'slug' => 'new-organization',
'type' => 'company'
]);