$direct = $ig->direct->getInbox();
$threads = $direct->inbox->threads;
$oncekisayfa = $direct->inbox->oldest_cursor;
$i = 0 ;
foreach ($threads as $thread) {

    $users = $thread->users;
    foreach ($users as $user) {
        $use[$user->username] = $user;
    }

    $items = $thread->items;
    $inviter = $thread->thread_title;
    if(!empty($inviter) && isset($use[$inviter])){
        $i++;
        $last = $thread->last_activity_at;

        foreach ($items as $item) {
            $type = $item->item_type; ?>
            <li class="collection-item avatar ">
                <a style="color: black;" target="_blank" href="https://www.instagram.com/<?php echo $use[$inviter]->username; ?>" >
                    <img src="<?php echo $use[$inviter]->profile_pic_url; ?>" alt="" class="circle">
                    <span class="title">@<?php echo $use[$inviter]->username; ?> ( <?php echo $use[$inviter]->full_name; ?> )</span>
                </a>
                <a style="color: black;" href="dmoku.php?thread_id=<?php echo $thread->thread_id; ?>" >
                    <p><?php if ($type == 'text') { echo $item->text; } ?>....
                </a>
                </p>

                <p class="secondary-content" >
                    <input type="checkbox" class="filled-in chetbozx" value="<?php echo $thread->thread_id; ?>" id="filled-in-box-<?php echo $thread->thread_id; ?>" name="islem[]" />
                    <label for="filled-in-box-<?php echo $thread->thread_id; ?>"></label>
                </p>
            </li>
            <?php
        }
    }
}
eskiden kendim birşeyler yapmıştım oradan kopyaladım bi incelyin isteterseniz