PHPackages                             mattsmithdev/pdo-repo-project - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. mattsmithdev/pdo-repo-project

ActiveTemplate[Templating &amp; Views](/categories/templating)

mattsmithdev/pdo-repo-project
=============================

A project template to make creating new pdo-crud-for-free-repositories projects easier.

v1.2(1y ago)033MITPHP

Since Jan 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dr-matt-smith/pdo-crud-for-free-repositories-example-project)[ Packagist](https://packagist.org/packages/mattsmithdev/pdo-repo-project)[ Docs](https://github.com/dr-matt-smith/pdo-crud-for-free-repositories-example-project)[ RSS](/packages/mattsmithdev-pdo-repo-project/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (10)Dependencies (1)Versions (12)Used By (0)

pdo-crud-for-free-repositories-sample-project
=============================================

[](#pdo-crud-for-free-repositories-sample-project)

This sample project illustrates how to use the PHP package:

- [pdo-crud-for-free-repositories](https://github.com/dr-matt-smith/pdo-crud-for-free-repositories)

    - visit that repository and look at the README to learn how to use the library ...

All code is (intended :-) to follow PSR-1, PSR-12 coding standards. Classes are following the PSR-4 autoloading standard.

Install 1 - Get the files on your computer
------------------------------------------

[](#install-1---get-the-files-on-your-computer)

Via Composer with the `create-project` option, change `demo1` to whatever you want the project folder name to be:

```
composer create-project mattsmithdev/pdo-repo-project demo1
```

Via Git clone:

```
    $ git clone git@github.com:dr-matt-smith/pdo-crud-for-free-repositories-sample-project.git
```

Or just download the project ZIP from Github.

Install 2 - Declare your MySQL database settings in `/.env`
-----------------------------------------------------------

[](#install-2---declare-your-mysql-database-settings-in-env)

File `.env` defines the 5 required constants for DB access.

You will need an up-and-running MySQL (or compatible) DB server to use this project. Ensure you know the DB user and password for programs to connect and communicate with the DB server.

Update them as required for your own MySQL setup:

```
    MYSQL_USER=root
    MYSQL_PASSWORD=passpass
    MYSQL_HOST=127.0.0.1
    MYSQL_PORT=3306
    MYSQL_DATABASE=evote

```

NOTE: These variables names are chosen for easy deployment to Fortrabbit

- you'd think they'd want to buy me a coffee or something for advertising them ... :-)

Install 3 - Run the migration and initial data fixtures script
--------------------------------------------------------------

[](#install-3---run-the-migration-and-initial-data-fixtures-script)

There is a Composer script shortcut setup for you: `"setupdb": "php db/migrateAndLoadFixtures.php"`

So you can just type at the command line:

```
    $ composer setupdb
```

In folder `db` is a file `migrateAndLoadFixtures.php`. By running this script your create the DB table `movie`, and insert 2 initial records (with auto-increment IDs):

```
    $movieRepository->createAndInsert('Jaws', 9.99, 'horror');
    $movieRepository->createAndInsert('Jumanji', 7, 'entertainment');
```

The database and table will be created automatically if they don't already exist.

Run the web server
------------------

[](#run-the-web-server)

Run your web server, making `/public` the web root:

```
  $ php -S localhost:8000 -t public
```

Or use Composer script shortcut:

```
    $ composer serve
```

Open a browser
--------------

[](#open-a-browser)

Open a browser to `http://localhost:8000`

or whatever port at which your webserver is running:

[![screenshot of browser](screenshot2.png)](screenshot2.png)

About this project
------------------

[](#about-this-project)

The features of this project can be summaraised as follows:

- a single 'Front Controller' file `public/index.php` creates an `Application` object and invokes its `run()` method
- the `run()` method tests for a url-encoded variable `action`
- if url-encoded variable `action` has value `movies` then method `Application->list_movies()` is invoked, otherwise method `Application->index()` is invoked
- `Application->index()` displays template file `templates/homepage.php` - a basic home page, with a 2-item navigation bar (to home and movie list)
- `Application->listMovies()` creates a `MovieRepository` object and uses its `findAll()` method to create an array containing `Movie` objects for each row retrieved from the database table `movie`, then displays template file `templates/movies_list.php` - a page that loops through the `$movies` array, and also displays a 2-item navigation bar (to home and movie list)

The `Movie` class is a simple entity class - with an int `id` property, properties for movie objects (like title and price), and public getters and setters.

The `MovieRepository` class extends the library class `Mattsmithdev\PdoCrudRepo\DatabaseTableRepository` (which has been copied by Composer into the `vendor` directory). These library classes provide a **very simple** ORM (Object-Relational Mapper), allowing basic CRUD operations with no need to manually create DB connections or write SQL etc.

For more information about the pdo-crud-for-free-repositories library see that project's Github page:

-

have fun

.. matt smith .. June 2022

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~102 days

Recently: every ~256 days

Total

11

Last Release

549d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ae5a872d27445abd90dd3972feaf090688537736bda9b28054d4aa4fedf5ef2?d=identicon)[mattsmithdev](/maintainers/mattsmithdev)

---

Top Contributors

[![dr-matt-smith](https://avatars.githubusercontent.com/u/1216855?v=4)](https://github.com/dr-matt-smith "dr-matt-smith (17 commits)")

---

Tags

template

### Embed Badge

![Health badge](/badges/mattsmithdev-pdo-repo-project/health.svg)

```
[![Health](https://phpackages.com/badges/mattsmithdev-pdo-repo-project/health.svg)](https://phpackages.com/packages/mattsmithdev-pdo-repo-project)
```

###  Alternatives

[phpoffice/phpword

PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)

7.5k34.7M183](/packages/phpoffice-phpword)[rize/uri-template

PHP URI Template (RFC 6570) supports both expansion &amp; extraction

420137.3M46](/packages/rize-uri-template)[mopa/bootstrap-sandbox-bundle

Seperate live docs from code

256.8k](/packages/mopa-bootstrap-sandbox-bundle)[larablocks/pigeon

A more flexible email message builder for Laravel 5 including chained methods, reusable message configurations, and message layout and template view management.

143.7k](/packages/larablocks-pigeon)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
