PHP code example of miragepresent / likeable

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

    

miragepresent / likeable example snippets



/** @var \App\Photo $photo */
$photo = Photo::find(1); 
 
// Add like to the photo
$photo->like();
 
var_dump($photo->is_liked); \\ true, 1
 
echo $photo->count_likes. ' user(s) liked this photo';
echo $photo->likedBy->ipmlode('name', ',') . ' liked this photo';