PHP Classes

How to Access a PHP Movie Database Using the Package My Personal Collection: Manage a collection of movies stored in PHP array

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2025-06-11 (Less than 1 hour ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
my-personal-collecti 1.0MIT/X Consortium ...5PHP 5, Databases, Video
Description 

Author

This package can manage a collection of movies stored in PHP array.

It provides classes that can load the details of movies and actor from an array.

The package classes can traverse the list of movies and return the details of each movie.

Picture of Pierre-Henry Soria
  Performance   Level  
Name: Pierre-Henry Soria <contact>
Classes: 52 packages by
Country: United Kingdom
Age: 32
All time rank: 37116 in United Kingdom
Week rank: 22 Up3 in United Kingdom Up
Innovation award
Innovation award
Nominee: 18x

Winner: 3x

Instructions

Please check this example script to load movie data from an array and access it to learn how to use this package.

Example

<?php
/**
 * @author Pierre-Henry Soria <[email protected]>
 * @copyright (c) 2015, Pierre-Henry Soria. All Rights Reserved.
 * @license MIT License <http://www.opensource.org/licenses/mit-license.php>
 * @link http://github.com/pH-7/
 */

require 'Movie.class.php';
require
'Actor.class.php';

try
{
   
$oMovie = new Movie;
   
$oActor = new Actor;

   
$aMovies = include 'movies.data.php'; // Get Actors & Movies
   
$oMovie->setData($aMovies);

    foreach (
$oMovie->getData() as $aMovie)
    {
        echo
'----- Movie Name -----<br />';

       
$oMovie->setTitle($aMovie['title'])->setRelease($aMovie['release'])->setRuntime($aMovie['runtime']);

        echo
'Title: ' . $oMovie->getTitle() . '<br />';
        echo
'Release: ' . $oMovie->getRelease() . '<br />';
        echo
'Runtime: ' . $oMovie->getRuntime() . '<br />';

        echo
'----- Actors -----<br />';
       
$aActors = $oMovie->getActorsOrderedByAge($aMovie['actors']);
        foreach (
$aActors as $aActor)
        {
           
$oActor->setName($aActor['name'])->setBirthDate($aActor['dob']);

            echo
'Name: ' . $oActor->getName() . '<br />';
            echo
'Date of Birth: ' . $oActor->getBirthDate() . '<br />';
            echo
'---<br />';
        }
        echo
'<br /><br />';
    }

   
/**
      // Get result in JSON
      echo $oMovie->getJsonData();
      echo $oActor->getJsonData();
    **/

}
catch (
exception $oE)
{
    echo
$oE->getMessage();
}


  Files folder image Files (7)  
File Role Description
Plain text file Actor.class.php Class Class source
Plain text file Base.class.php Class Class source
Accessible without login Plain text file exp.class.php Example Example script
Accessible without login Plain text file index.php Example Example script
Plain text file Movie.class.php Class Class source
Accessible without login Plain text file movies.data.php Conf. Configuration script
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0