Level 70
@xanderjuniordev Looping $videoList doesn't work for you?
@foreach($videoList as $video)
// Do whatever you need.
@endforeach
3 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello, I am working on a project with the YouTube API. Now I am trying to display information from an array, for example the snippet, but I don't know how to do it, and I don't have an answer that works for me. If anyone with experience can help me out, I would really appreciate it.
use Alaouy\Youtube\Facades\Youtube;
public function index()
{
// List videos in a given channel, return an array of PHP objects
$item = Youtube::listChannelVideos('UCLVMKLtleeiKs0Oqp86ApTQ', 5);
$videoList = collect($item);
return view('welcome', compact('videoList'));
}
<div class="screen-box">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12 text-center">
<h1> Name </h1>
{{ $videoList }}
</div>
</div>
</div>
</div>
This is what i get when i dd($item)
^ array:5 [▼
0 => {#410 ▼
+"kind": "youtube#searchResult"
+"etag": "atD_1xg-o6qgZp8qSOndXwijXxI"
+"id": {#411 ▶}
+"snippet": {#412 ▶}
}
1 => {#417 ▼
+"kind": "youtube#searchResult"
+"etag": "wVIhea7QN5uF6ISoN7GhRJDblV0"
+"id": {#418 ▶}
+"snippet": {#419 ▶}
}
2 => {#424 ▼
+"kind": "youtube#searchResult"
+"etag": "NQWrxs2Q4m2GCKeuLiYvlPjr5FU"
+"id": {#425 ▶}
+"snippet": {#426 ▶}
}
3 => {#431 ▼
+"kind": "youtube#searchResult"
+"etag": "8v-dnjyVVmyYg628DBGiBOM_9Ig"
+"id": {#432 ▶}
+"snippet": {#433 ▶}
}
4 => {#438 ▼
+"kind": "youtube#searchResult"
+"etag": "iX-PNs59KILyVLIchjYDbG4nvdk"
+"id": {#439 ▶}
+"snippet": {#440 ▶}
}
]
@xanderjuniordev Looping $videoList doesn't work for you?
@foreach($videoList as $video)
// Do whatever you need.
@endforeach
Please or to participate in this conversation.