定制 mrsems/paginator-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrsems/paginator-php

最新稳定版本:v1.0.0

Composer 安装命令:

composer require mrsems/paginator-php

包简介

Simple PHP array paginator.

README 文档

README

Packagist Version PHP Version License

Paginator-PHP est une classe PHP simple permettant de paginer des tableaux de données sans dépendre d'un framework.

✔️ Pagination basée sur $_GET['page']
✔️ Informations sur la pagination (page actuelle, total pages...)
✔️ Facile à intégrer dans n'importe quel projet PHP

composer require mrsems/paginator-php

exemple d'utilisation 
<?php
require 'vendor/autoload.php';

use App\Paginator\Paginator;

$items = range(1, 50);

$result = Paginator::paginate($items, 5);

?>

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <title>Test Paginator PHP</title>
    <script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="p-8">

<h1 class="text-2xl font-bold mb-4">Liste paginée</h1>

<ul class="list-disc pl-5 mb-4">
    <?php foreach ($result['items'] as $item): ?>
        <li><?= htmlspecialchars($item) ?></li>
    <?php endforeach; ?>
</ul>

<div class="flex gap-2">
    <?php if ($result['hasPrevious']): ?>
        <a href="?page=<?= $result['currentPage'] - 1 ?>" class="px-4 py-2 bg-blue-500 text-white rounded">Précédent</a>
    <?php endif; ?>

    <?php if ($result['hasNext']): ?>
        <a href="?page=<?= $result['currentPage'] + 1 ?>" class="px-4 py-2 bg-blue-500 text-white rounded">Suivant</a>
    <?php endif; ?>
</div>

</body>
</html>

统计信息

  • 总下载量: 35
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-16