PHP code example of wedocreatives / toggl

1. Go to this page and download the library: Download wedocreatives/toggl 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/ */

    

wedocreatives / toggl example snippets



    'providers'         => array(

        //...
        Wedocreatives\Toggl\TogglServiceProvider::class,

    )



    'aliases'           => array(

        //...
        'Toggl'         => Wedocreatives\Toggl\Facades\Toggl::class,

    ),



    'toggl' => [
        'workspace'     => env('TOGGL_WORKSPACE'),
        'token'         => env('TOGGL_TOKEN'),
    ],



    $workspaceId = 123;
    $apiToken = 'your_toggl_api_token';
    $togglService = new \Wedocreatives\Toggl\TogglService( $workspaceId, $apiToken );



    // Return an overview of what users in the workspace are doing and have been doing
    $response = Toggl::dashboard();

    // Create a client
    $response = Toggl::createClient( array( "name" => "Test company" ) ) );

    // Get a summary information of this month for all user 
    $response = Toggl::summaryThisMonth();

    // Get a summary information of last month for one specific user 
    $response = Toggl::summaryLastMonth( array( 'user_ids' => '123' ) ) );



    $workspaceId = 123;
    $apiToken = 'your_toggl_api_token';
    $togglService = new \Wedocreatives\Toggl\TogglService( $workspaceId, $apiToken );

    // Return an overview of what users in the workspace are doing and have been doing
    $response = $togglService->dashboard();

    // Create a client
    $response = $togglService->createClient( array( "name" => "Test company" ) ) );

    // Get a summary information of this month for all user 
    $response = $togglService->summaryThisMonth();

    // Get a summary information of last month for one specific user 
    $response = $togglService->summaryLastMonth( array( 'user_ids' => '123' ) ) );


class_alias('Wedocreatives\Toggl\Facades\Toggl', 'Toggl');