Code Monkey home page Code Monkey logo

php-monday-api's Introduction

Monday API

Monday.com API

Installation & loading

Monday API is available on Packagist (using semantic versioning), and installation via Composer is the recommended way to install Monday API. Just add this line to your composer.json file:

"tblack-it/monday-api": "~0.2"

or run

composer require tblack-it/monday-api

Note that the vendor folder and the vendor/autoload.php script are generated by Composer; they are not part of Monday API

Examples

Init Monday connector

<?php

require 'vendor/autoload.php';

$token = 'API_TOKEN';
$MondayBoard = new TBlack\MondayAPI\MondayBoard();
$MondayBoard->setToken(new TBlack\MondayAPI\Token($token));

Interact with boards

# Get all boards
$all_boards = $MondayBoard->getBoards();

# Get Board id : 10012
$board_id = 10012;
$board = $MondayBoard->on($board_id)->getBoards();

# Get Board Columns
$board_id = 10012;
$boardColumns = $MondayBoard->on($board_id)->getColumns();

# Create Board, if success return board_id
$newboard = $MondayBoard->create( 'New Board Name', TBlack\MondayAPI\ObjectTypes\BoardKind::PUB );
$board_id = $newboard['create_board']['id'];

Interact with Itens

# Insert new Item on Board
$board_id = 10012;
$id_group = 'topics';
$column_values = [ 'text1' => 'Value...','text2' => 'Other value...' ];

$addResult = $MondayBoard
              ->on($board_id)
              ->group($id_group)
              ->addItem( 'My Item Title', $column_values );

# If you want to use the `create_labels_if_missing` arguments; just add `true` as the third arguments (default: `false`)
$addResult = $MondayBoard
              ->on($board_id)
              ->group($id_group)
              ->addItem( 'My Item Title', $column_values, true);

# if succes return
$item_id = $addResult['create_item']['id'];

# For update Item
$item_id = 34112;
$column_values = [ 'text1' => 'New Value','text2' => 'New other value...' ];

$updateResult = $MondayBoard
              ->on($board_id)
              ->group($id_group)
              ->changeMultipleColumnValues($item_id, $column_values );

# Archive item
$result = $MondayBoard
              ->on($board_id)
              ->group($id_group)
              ->archiveItem($item_id);

// Delete item
$result = $MondayBoard
              ->on($board_id)
              ->group($id_group)
              ->deleteItem($item_id);

If you need specific action, you can run a custom Query or Mutation

// Run a custom query
$query = '
boards (ids: 12121212) {
  groups (ids: group_id) {
    items {
      id
      name
      column_values {
        id
        text
        title
      }
    }
  }
}';

# For Query
$items = $MondayBoard->customQuery( $query );

# For Mutation
$items = $MondayBoard->customMutation( $query );

To get the error message

$error = $MondayBoard->error;

php-monday-api's People

Contributors

peter9x avatar tanasecosminromeo avatar proclame avatar goper-leo avatar irworks avatar will2therich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.