PHP Classes

PHP Games PEGI: Display PEGI ratings about games from an array

Recommend this page to a friend!
  Info   Example   Demos   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-03-09 (7 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 9 All time: 11,442 This week: 55Up
Version License PHP version Categories
phppegi 1.0.1Custom (specified...5.6Libraries, Games, Content management, P...
Description 

Author

This package can display PEGI ratings about games from an array.

It provides a class that can get details of game ratings according to the PEGI standard, such as the rating title, description, age range, and associated image.

The package can return localized rating titles and descriptions in multiple languages, displaying the ratings according to the user's preferred language.

PEGI helps parents make informed decisions when buying video games

Innovation Award
PHP Programming Innovation award nominee
March 2024
Number 8
PEGI is a standard that details game age ratings to help parents decide whether a game is suitable for a specific age group.

This standard defines text and graphic labels that should be displayed with games so parents can see the recommended age for each game.

This package shows how to display the PEGI age ratings for each game.

The rating titles and descriptions can be displayed in multiple languages, so parents from different countries can understand the ratings by reading the details in their country's language.

Manuel Lemos
Picture of ASCOOS CMS
  Performance   Level  
Name: ASCOOS CMS <contact>
Classes: 16 packages by
Country: Greece Greece
Age: ???
All time rank: 395723 in Greece Greece
Week rank: 7 Up1 in Greece Greece Up
Innovation award
Innovation award
Nominee: 11x

Instructions

USE

In the index.php example file, replace the $cms_site variable with the actual address where you will run this package.

$cms_site = '[YOUR REAL SITE PATH -- https://www.example.com/phpPEGI]';

In the Data folder, I've created a data.php file that has a table of examples inside. In real life, this could be done by creating a database and code that would pull this data.

Example

<?php
/**
 * __ _ ___ ___ ___ ___ ___ ____ _ __ ___ ___
 * / _` |/ / / __/ _ \ / _ \ / / / __/| '_ ` _ \ / /
 * | (_| |\ \| (_| (_) | (_) |\ \ | (__ | | | | | |\ \
 * \__,_|/__/ \___\___/ \___/ /__/ \___\|_| |_| |_|/__/
 *
 *
 *************************************************************************************
 * @ASCOOS-NAME : ASCOOS CMS 24' *
 * @ASCOOS-VERSION : 24.0.0 *
 * @ASCOOS-CATEGORY : Kernel (Frontend and Administration Side) *
 * @ASCOOS-CREATOR : Drogidis Christos *
 * @ASCOOS-SITE : www.ascoos.com *
 * @ASCOOS-LICENSE : [Commercial] http://docs.ascoos.com/lics/ascoos/AGL-F.html *
 * @ASCOOS-COPYRIGHT : Copyright (c) 2007 - 2023, AlexSoft Software. *
 *************************************************************************************
 *
 * @package : ASCOOS CMS - phpPEGI
 * @subpackage : phpPEGI Example Index File
 * @source : /phpPEGI/index.php
 * @version : 1.0.0
 * @created : 2024-02-29 09:00:00 UTC+3
 * @updated : 2024-03-01 11:00:00 UTC+3
 * @author : Drogidis Christos
 * @authorSite : www.alexsoft.gr
 */


define('ALEXSOFT_RUN_CMS', true);

$cms_path = str_replace('\\', '/', __DIR__);
$cms_site = '[YOUR REAL SITE PATH -- https://www.example.com/phpPEGI]';


require_once(
$cms_path.'/libs/phpPEGI.php');
require_once(
$cms_path."/data/data.php");



/**
 *
 * Ages = '3', '7', '12', '16', '18'
 * Content = 'Bad', 'Discrimination', 'Drugs', 'Fear', 'Gambling', 'Parental', 'Purchases', 'Sex', 'Violence'
 */
$pegis = [
   
'age' => '3', // ONLY 1 Value
   
'content' => ['Bad', 'Violence', 'Purchases'] // 0-4 Contents
];


$options = [
   
'lang' => null // Auto Read Browser Language
];


$objPEGI = new TPEGIHandler($options);
?>
<!DOCTYPE html>
<html lang="<?php echo $objPEGI->getLang(); ?>">
<head>
    <meta charset="UTF-8">
    <title>Page Title</title>
    <link rel="stylesheet" href="<?php echo $cms_site; ?>/themes/default/theme.css"/>
</head>
<body>

<div class="center">
<div class="container">
   
<?php
$gtxt
= '';
foreach (
$games['pegi'] as $pegi_key => $pegi_values)
{
    foreach (
$pegi_values as $game)
    {
       
$gtxt .= '<div class="card age'.$pegi_key.'">';
       
$gtxt .= '<div class="additional">';
       
$gtxt .= '<div class="user-card">';
       
$gtxt .= '<div class="level center">PEGI '.$pegi_key.'</div>';
       
$gtxt .= '<div class="points center">'.$objPEGI->getAge($pegi_key).'</div>';
       
$gtxt .= '<i><img src="themes/default/images/'.$objPEGI->getImage($pegi_key).'" height="128" alt="title" /></i>';
       
$gtxt .= '</div>';
       
$gtxt .= '<div class="more-info">';
       
$gtxt .= '<h1>'.$game['title'].'</h1>';
       
$gtxt .= '<div class="stats">';
       
       
$txt = '';

        foreach (
$game['content'] as $content)
        {
           
$txt .= '<div>';
           
$txt .= '<i><img src="themes/default/images/'.$objPEGI->getImage($content).'" height="68" alt="'.$objPEGI->getTitle($content).'" /></i>';
           
$txt .= '</div>';
        }
    
       
$gtxt .= $txt;
       
$gtxt .= '</div>';
       
$gtxt .= '</div>';
       
$gtxt .= '</div>';
       
$gtxt .= '<div class="general">';
       
$gtxt .= '<div class="more-info">';
       
$gtxt .= '<h1>'.$game['title'].'</h1>';
       
$gtxt .= '<div class="coords">';
       
$gtxt .= mb_strcut($game['description'], 0, 150).'...';
       
$gtxt .= '</div>';
       
$gtxt .= '</div>';
       
$gtxt .= '<p> </p>';
       
$gtxt .= '<span class="more">'.$game['publiser'].'</span>';
       
$gtxt .= '</div>';
       
$gtxt .= '</div>';
    }
}
echo
$gtxt;
?>
</div>
</div>
</body>
</html>
<?php unset($objPEGI); ?>


Details

PEGI (Pan European Game Information)

PEGI helps parents to make informed decisions when buying video games

PEGI provides age classifications for video games in 38 European countries. The age rating confirms that the game content is appropriate for players of certain age. PEGI considers the age suitability of a game, not the level of difficulty.

Age ratings are systems used to ensure that entertainment content, such as games, but also films, tv shows or mobile apps, is clearly labelled with a minimum age recommendation based on the content they have. These age ratings provide guidance to consumers, parents in particular, to help them decide whether or not to buy a particular product for a child.

Video games are enjoyed by a very diverse group of players throughout Europe. Both children and adults, men and women, play games regularly, either on a dedicated game console, a personal computer, or a mobile device like a smartphone or a tablet.

While most games are suitable for players of all ages, others are only suitable for older children and young teenagers. A specific portion of games on the market contains content that is only appropriate for an adult audience.

The PEGI rating considers the age suitability of a game, not the level of difficulty. A PEGI 3 game will not contain any inappropriate content, but can sometimes be too difficult to master for younger children. Reversely, there are PEGI 18 games that are very easy to play, yet they contain elements that make them inappropriate for a younger audience.

PEGI is used and recognised throughout Europe and has the enthusiastic support of the European Commission. It is considered as a model of European harmonisation in the field of the protection of children.

USE

1) In the index.php example file, replace the $cms_site variable with the actual address where you will run this package.

$cms_site = '[YOUR REAL SITE PATH -- https://www.example.com/phpPEGI]';

2) In the Data folder, I've created a data.php file that has a table of examples inside. In real life, this could be done by creating a database and code that would pull this data.


  phpPEGI ExampleExternal page  

Open in a separate window

Screenshots (1)  
  • help/phpPEGI-Test -Screenshot.png
  Files folder image Files (79)  
File Role Description
Files folder imagedata (2 files)
Files folder imagehelp (1 file)
Files folder imagelanguages (5 files)
Files folder imagelibs (2 files)
Files folder imagethemes (1 file, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE_AGL-F.md Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (79)  /  data  
File Role Description
  Accessible without login Plain text file data.php Conf. Games configuration
  Accessible without login Plain text file index.html Data Empty page

  Files folder image Files (79)  /  help  
File Role Description
  Accessible without login Plain text file index.html Data Empty page

  Files folder image Files (79)  /  languages  
File Role Description
  Accessible without login Plain text file de.php Conf. Language configuration script
  Accessible without login Plain text file el.php Conf. Language configuration script
  Accessible without login Plain text file en.php Conf. Language configuration script
  Accessible without login Plain text file fr.php Conf. Language configuration script
  Accessible without login HTML file index.html Data Empty page

  Files folder image Files (79)  /  libs  
File Role Description
  Accessible without login Plain text file index.html Data Empty page
  Plain text file phpPEGI.php Class Class source

  Files folder image Files (79)  /  themes  
File Role Description
Files folder imagedefault (2 files, 1 directory)
  Accessible without login Plain text file index.html Data Empty page

  Files folder image Files (79)  /  themes  /  default  
File Role Description
Files folder imageimages (61 files)
  Accessible without login Plain text file index.html Data Empty page
  Accessible without login Plain text file theme.css Data Auxiliary data

  Files folder image Files (79)  /  themes  /  default  /  images  
File Role Description
  Accessible without login Plain text file 1.svg Data Auxiliary data
  Accessible without login Plain text file 10.svg Data Auxiliary data
  Accessible without login Plain text file 11.svg Data Auxiliary data
  Accessible without login Plain text file 12.svg Data Auxiliary data
  Accessible without login Plain text file 12w.svg Data Auxiliary data
  Accessible without login Plain text file 13.svg Data Auxiliary data
  Accessible without login Plain text file 14.svg Data Auxiliary data
  Accessible without login Plain text file 15.svg Data Auxiliary data
  Accessible without login Plain text file 16.svg Data Auxiliary data
  Accessible without login Plain text file 16b.svg Data Auxiliary data
  Accessible without login Plain text file 16w.svg Data Auxiliary data
  Accessible without login Plain text file 17.svg Data Auxiliary data
  Accessible without login Plain text file 18.svg Data Auxiliary data
  Accessible without login Plain text file 18w.svg Data Auxiliary data
  Accessible without login Plain text file 19.svg Data Auxiliary data
  Accessible without login Plain text file 2.svg Data Auxiliary data
  Accessible without login Plain text file 20.svg Data Auxiliary data
  Accessible without login Plain text file 21.svg Data Auxiliary data
  Accessible without login Plain text file 3.svg Data Auxiliary data
  Accessible without login Plain text file 3w.svg Data Auxiliary data
  Accessible without login Plain text file 4.svg Data Auxiliary data
  Accessible without login Plain text file 5.svg Data Auxiliary data
  Accessible without login Plain text file 6.svg Data Auxiliary data
  Accessible without login Plain text file 7.svg Data Auxiliary data
  Accessible without login Plain text file 7w.svg Data Auxiliary data
  Accessible without login Plain text file 8.svg Data Auxiliary data
  Accessible without login Plain text file 9.svg Data Auxiliary data
  Accessible without login Plain text file age.svg Data Auxiliary data
  Accessible without login Image file DE-bad-language.png Icon Icon image
  Accessible without login Image file DE-discrimination.png Icon Icon image
  Accessible without login Image file DE-drugs.png Icon Icon image
  Accessible without login Image file DE-fear.png Icon Icon image
  Accessible without login Image file DE-gambling.png Icon Icon image
  Accessible without login Image file DE-in-game-purchase.png Icon Icon image
  Accessible without login Image file DE-sexual-content.png Icon Icon image
  Accessible without login Image file DE-violence.png Icon Icon image
  Accessible without login Image file EL-bad-language.png Icon Icon image
  Accessible without login Image file EL-discrimination.png Icon Icon image
  Accessible without login Image file EL-drugs.png Icon Icon image
  Accessible without login Image file EL-fear.png Icon Icon image
  Accessible without login Image file EL-gambling.png Icon Icon image
  Accessible without login Image file EL-in-game-purchase.png Icon Icon image
  Accessible without login Image file EL-sexual-content.png Icon Icon image
  Accessible without login Image file EL-violence.png Icon Icon image
  Accessible without login Image file EN-bad-language.png Icon Icon image
  Accessible without login Image file EN-discrimination.png Icon Icon image
  Accessible without login Image file EN-drugs.png Icon Icon image
  Accessible without login Image file EN-fear.png Icon Icon image
  Accessible without login Image file EN-gambling.png Icon Icon image
  Accessible without login Image file EN-in-game-purchase.png Icon Icon image
  Accessible without login Image file EN-sexual-content.png Icon Icon image
  Accessible without login Image file EN-violence.png Icon Icon image
  Accessible without login Image file FR-bad-language.png Icon Icon image
  Accessible without login Image file FR-discrimination.png Icon Icon image
  Accessible without login Image file FR-drugs.png Icon Icon image
  Accessible without login Image file FR-fear.png Icon Icon image
  Accessible without login Image file FR-gambling.png Icon Icon image
  Accessible without login Image file FR-in-game-purchase.png Icon Icon image
  Accessible without login Image file FR-sexual-content.png Icon Icon image
  Accessible without login Image file FR-violence.png Icon Icon image
  Accessible without login HTML file index.html 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
Downloadphppegi-2024-03-09.zip 2004KB
Downloadphppegi-2024-03-09.tar.gz
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
PHP Backwards Compatibility Library Download .zip .tar.gz This package included in Ascoos Cms Optional
 Version Control Unique User Downloads Download Rankings  
 100%
Total:9
This week:0
All time:11,442
This week:55Up