Download the PHP package pagemill/mvc without Composer

On this page you can find all versions of the php package pagemill/mvc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mvc

PageMill MVC

PHP Version

A lightweight, modern PHP MVC framework focused on developer experience and clean architecture. PageMill MVC provides the essential building blocks for web applications without the bloat, making it perfect for developers who want control without complexity.

Why PageMill MVC? Built for modern PHP (8.2+), fully type-hinted, extensively tested (368 tests, 100% file coverage), and designed around proven patterns. It's the MVC framework that gets out of your way and lets you build.

Features

Requirements

Installation

Install via Composer:

The framework will automatically install its dependencies:

Quick Start

Here's a minimal example to get you up and running in under 5 minutes:

1. Create a Simple Controller

2. Create a View

3. Create a Responder

4. Wire It Up

That's it! You now have a working MVC application.

Core Concepts

PageMill MVC follows a request/response flow through four main components:

Controllers

Controllers orchestrate the request handling. They:

Actions

Actions contain reusable business logic:

Models

Models fetch and prepare data:

Responders

Responders handle content negotiation and choose the appropriate view:

Views

Views generate output. HTML views extend Template\HTMLAbstract:

JSON views extend View\JSONAbstract:

Asset Management

PageMill MVC includes a powerful asset management system for CSS and JavaScript:

Basic Asset Usage

Asset Locations

Configure where assets are stored:

Inline Assets

Embed assets directly in HTML:

Combined Assets

Use the Combine class to serve multiple assets as one file:

URL format: /combine.php?css=normalize,main,app&v=12345

Element Assets

Automatically load assets from UI components:

Document Metadata

Manage page metadata with the Document class:

UI Components (Elements)

Create reusable UI components:

Configuration

Environment Settings

Property Mapping

The PropertyMap trait maps array data to object properties with type validation:

API Reference

Core Classes

ControllerAbstract

Purpose: Orchestrates request handling

Key Methods:

ActionAbstract

Purpose: Encapsulates reusable business logic

Key Methods:

ModelAbstract

Purpose: Fetches and prepares data

Key Methods:

ResponderAbstract

Purpose: Handles content negotiation and response generation

Key Methods:

ViewAbstract

Purpose: Base class for all views

Properties:

Key Methods:

HTML/Template Classes

Template\HTMLAbstract

Purpose: Base class for HTML views

Properties:

Key Methods:

View\JSONAbstract

Purpose: Base class for JSON API responses

Key Methods:

HTML\Document

Purpose: Manages document metadata

Properties:

Key Methods:

HTML\Assets

Purpose: Manages CSS and JavaScript assets

Key Methods:

HTML\Assets\Injector

Purpose: Automatically loads assets from Element classes

Key Methods:

ElementAbstract

Purpose: Base class for reusable UI components

Key Methods:

Utility Classes

Environment

Purpose: Global configuration manager

Key Methods:

Traits\PropertyMap

Purpose: Type-safe property mapping

Key Methods:

Advanced Usage

Custom Content Types

Support custom response formats:

Nested Actions

Actions can be composed for complex workflows:

Custom Asset Handlers

Create custom asset output formats:

Error Handling

Testing

Running Tests

Run the complete test suite:

Test Coverage

The framework has comprehensive test coverage:

See tests/README.md for detailed coverage information.

Writing Tests for Your Application

Example controller test:

Architecture & Best Practices

Request Flow

  1. Request arrives โ†’ Create Request object
  2. Controller instantiated โ†’ Filters input
  3. Request actions execute โ†’ Validation, authorization
  4. Models built โ†’ Data fetched
  5. Data actions execute โ†’ Transform/enrich data
  6. Responder chooses view โ†’ Based on Accept header
  7. View generates output โ†’ HTML, JSON, etc.
  8. Response sent โ†’ Complete

Separation of Concerns

When to Use What

Use Controllers when:

Use Actions when:

Use Models when:

Use Elements when:

Performance Tips

  1. Asset Combining - Use Combine to reduce HTTP requests
  2. Lazy Loading - Only load what you need when you need it
  3. Caching - Assets class supports MD5 fingerprinting for cache busting
  4. Inline Critical CSS - Use $assets->inline() for above-the-fold styles

Troubleshooting

Common Issues

Problem: "Class not found" errors

Solution: Run composer dump-autoload to regenerate autoload files.


Problem: Assets not loading

Solution: Ensure asset locations are configured correctly:


Problem: Type errors when mapping properties

Solution: Ensure your input data types match property types, or use constraints:


Problem: "Unknown configuration input" exception

Solution: Either add the property to your class, or use ignore mode:

FAQ

Q: Do I have to use all components?

A: No! Use what you need. The framework is designed to be modular. You can use just the asset management, just the MVC components, or everything together.

Q: Can I use this with existing frameworks?

A: Yes, PageMill MVC can be integrated into existing applications. The components are standalone and don't require a specific application structure.

Q: How do I handle AJAX requests?

A: Use JSONAbstract views and let the Responder handle content negotiation automatically based on the Accept header.

Q: Is this production-ready?

A: Yes. The framework is fully tested, type-safe, and follows modern PHP best practices.

Q: What's the performance like?

A: PageMill MVC is lightweight with minimal overhead. The asset system includes combining and caching for production optimization.

Q: Can I extend the base classes?

A: Absolutely! All abstract classes are designed to be extended. That's the whole point.

Contributing

We welcome contributions! Here's how you can help:

Reporting Bugs

  1. Check if the bug has already been reported in Issues
  2. Create a new issue with:
    • Clear description of the problem
    • Steps to reproduce
    • Expected vs actual behavior
    • PHP version and environment details

Suggesting Features

  1. Open an issue describing the feature
  2. Explain the use case and benefits
  3. Provide examples if possible

Submitting Pull Requests

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Write tests for your changes
  4. Ensure all tests pass (./vendor/bin/phpunit)
  5. Follow PSR-12 coding standards
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

Code Style

License

PageMill MVC is open-source software licensed under the BSD-3-Clause license.

Copyright ยฉ 1997-Present DealNews.com, Inc

Credits

Maintainer: DealNews.com, Inc

Dependencies


Built with โค๏ธ by developers, for developers.

For questions, issues, or discussions, please use the GitHub Issues page.


All versions of mvc with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
pagemill/http Version ^3.0
dealnews/filter Version ^2.0
pagemill/accept Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pagemill/mvc contains the following files

Loading the files please wait ...