Download the PHP package quellabs/canvas without Composer

On this page you can find all versions of the php package quellabs/canvas. 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 canvas

Canvas

Packagist

Canvas is a lightweight, modern PHP framework built for real-world projects. Whether you're starting fresh or modernizing legacy code, Canvas offers a clean architecture with annotation-based routing, contextual dependency injection, and an intuitive ORM. No magic, no bloat โ€” just the tools you actually need.

๐Ÿ”ง Key Features

Quick Start

Installation

Bootstrap (public/index.php)

This bootstrap file is automatically generated when using the skeleton package. If you're not using the skeleton package, you'll need to create this file manually.

Controllers with Route Annotations

Canvas automatically discovers controllers and registers their routes using annotations:

ObjectQuel ORM

ObjectQuel lets you query data using syntax that feels natural to PHP developers. Inspired by QUEL (a declarative query language from early relational databases), it bridges traditional database querying with object-oriented programming.

Simple Entity Operations

Advanced ObjectQuel Queries

For complex queries, ObjectQuel provides a natural language syntax:

Key Components

ObjectQuel Features

Route Validation & Parameters

Canvas provides powerful route parameter validation to ensure your controllers receive the correct data types and formats.

Basic Parameter Validation

Advanced Parameter Patterns

Available Validators

Route Prefixes

Group related routes under a common prefix:

Method Constraints

Restrict routes to specific HTTP methods:

Form Validation

Canvas provides a powerful validation system that separates validation logic from your controllers using aspects, keeping your business logic clean and focused.

Basic Form Validation

Creating Validation Classes

Define your validation rules in dedicated classes:

Available Validation Rules

Canvas includes common validation rules out of the box:

API Validation with Auto-Response

For API endpoints, enable automatic JSON error responses. When auto_respond=true, the validation aspect will automatically return error responses when validation fails, so you don't need to check validation results in your controller method:

Custom Validation Rules

Create your own validation rules by implementing the ValidationRuleInterface:

Use custom rules in your validation classes:

Input Sanitization

Canvas provides a powerful input sanitization system that automatically cleans and normalizes incoming request data before it reaches your controllers. The sanitization system works seamlessly with Canvas's validation system to provide a complete input security layer.

Why Sanitize Input?

Input sanitization is crucial for:

Basic Sanitization

Apply sanitization using the @InterceptWith annotation with SanitizeAspect:

Creating Sanitization Classes

Define your sanitization rules in dedicated classes that implement SanitizationInterface:

Built-in Sanitization Rules

Canvas includes essential sanitization rules focused on security and data cleaning:

Text Sanitization

Security Sanitization

URL and Path Sanitization

Combining Sanitization with Validation

Sanitization works best when combined with validation. The order depends on your specific needs:

Chain Sanitization

Apply multiple sanitization rules to the same field. Rules are executed in the order they're defined:

Custom Sanitization Rules

Create your own sanitization rules by implementing SanitizationRuleInterface. Here are examples of non-destructive sanitization:

Performance Considerations

Error Handling

Sanitization is designed to be non-breaking. Invalid sanitization classes or rules will throw descriptive exceptions:

Built-in Aspects

Canvas includes three powerful built-in aspects that handle common web application concerns. These aspects demonstrate the framework's commitment to security, performance, and best practices.

CSRF Protection Aspect

The CsrfProtectionAspect implements Cross-Site Request Forgery protection using tokens to ensure requests originate from your application.

Features

Basic Usage

Template Integration

Use the CSRF token in your forms:

AJAX Integration

For AJAX requests, include the token in headers:

Configuration Options

Customize CSRF protection behavior:

Parameters:

Security Headers Aspect

The SecurityHeadersAspect automatically adds security-related HTTP headers to protect against common web vulnerabilities following OWASP recommendations.

Protected Attacks

Basic Usage

Configuration Options

Customize security headers for different needs:

Parameters:

Content Security Policy Examples

Common CSP configurations for different application types:

Cache Aspect

The CacheAspect provides method-level caching with intelligent key generation, configurable TTL, and thread-safe operations.

Features

Basic Usage

Custom Cache Keys

Override automatic key generation:

Configuration Options

Parameters:

Cache Key Generation

The aspect automatically generates intelligent cache keys:

Performance Considerations

Inspector

Canvas includes a powerful visual inspector that appears at the bottom of your web pages during development. It provides essential insights into your application's performance, database queries, request data, and more.

Enabling the Inspector

The inspector is controlled by your application configuration:

Important: The inspector only appears on HTML responses.

Built-in Debug Panels

Canvas ships with essential debug panels that provide immediate value:

Request Panel ๐ŸŒ

Displays comprehensive request information:

Database Panel ๐Ÿ—„๏ธ

Shows database query analysis:

Inspector Features

Performance Statistics

The inspector header shows key performance metrics at a glance:

Interactive Interface

Smart HTML Injection

The inspector intelligently injects itself into your HTML responses:

Creating Custom Debug Panels

Extend the inspector with custom panels for your specific debugging needs:

Registering Custom Panels

Configure custom panels in your application config:

Debug Event System

The inspector uses Canvas's signal system to collect debugging information:

Emitting Debug Events

Emit debug events from your services:

Common Debug Signals

Canvas uses standardized signal patterns:

JavaScript API

The inspector provides a client-side JavaScript API for advanced interactions:

Best Practices

Development Workflow

  1. Enable inspector during development for immediate feedback
  2. Monitor query counts to identify N+1 problems
  3. Check execution times for performance bottlenecks
  4. Review request data to debug form submissions and routing issues

Security Considerations

Troubleshooting

Inspector Not Appearing

Check these common issues:

  1. Ensure enabled is set to true in config/inspector.php
  2. Verify the response is HTML (debug bar only works with HTML responses)
  3. Check that the response contains a closing </body> or </html> tag
  4. Ensure no JavaScript errors are preventing the bar from initializing

Performance Impact

The inspector is designed for development use:

Task Scheduling

Canvas includes a comprehensive task scheduling system that allows you to run background jobs on a cron-like schedule. The scheduler supports multiple execution strategies, timeout handling, and distributed locking to prevent concurrent task execution.

Creating Tasks

Create tasks by extending the AbstractTask class and implementing the required methods:

Task Discovery

Canvas automatically discovers tasks using its own discovery mechanism that reads from composer.json. Add your task classes to your composer.json:

After updating composer.json, run:

Running the Task Scheduler

Running the task scheduler is done through sculpt:

Setting Up Cron

Add this to your system's crontab to run the scheduler every minute:

Cron Schedule Format

Canvas uses standard cron expressions for scheduling:

Common Examples:

Timeout Strategies

Canvas automatically selects the best timeout strategy based on your system:

Event-Driven Architecture with SignalHub

Canvas includes a signal system inspired by Qt's signals and slots pattern, enabling components to communicate without tight coupling.

Basic Signal Usage

Add the HasSignals trait to emit signals from your classes:

Connecting to Signals

Listen for signals in other services:

Using Standalone Signals

Create global signals with SignalHub:

Controller Integration

Use signals in controllers with dependency injection:

Key Features

Legacy Integration

Canvas is designed to work seamlessly alongside existing PHP codebases, allowing you to modernize your applications incrementally without breaking existing functionality. The legacy integration system provides a smooth migration path from traditional PHP applications to Canvas.

Quick Start with Legacy Code

Start using Canvas today in your existing PHP application. No rewrites required - Canvas's intelligent fallthrough system lets you modernize at your own pace.

First, enable legacy support by updating your public/index.php:

That's it! Your existing application now has Canvas superpowers while everything continues to work exactly as before.

Using Canvas Services in Legacy Files

Now you can immediately start using Canvas services in your existing files:

How Route Fallthrough Works

Canvas uses an intelligent fallthrough system that tries Canvas routes first, then automatically looks for corresponding legacy PHP files:

Custom File Resolvers

If your legacy application has a different file structure, you can write custom file resolvers:

Legacy Preprocessing

Canvas includes preprocessing capabilities to handle legacy PHP files that use common patterns like header(), die(), and exit() functions. It also rewrites mysqli and pdo queries for automatic performance measuring in the inspector.

What preprocessing does:

Benefits of Legacy Integration

Advanced Features

Aspect-Oriented Programming

Canvas provides true AOP for controller methods, allowing you to separate crosscutting concerns from your business logic. Aspects execute at different stages of the request lifecycle.

Creating Aspects

Aspects implement interfaces based on when they should execute:

Applying Aspects

Class-level aspects apply to all methods in the controller:

Method-level aspects apply to specific methods:

Aspect Parameters

Pass configuration to aspects through annotation parameters:

The aspect receives these as constructor parameters:

Execution Order

Aspects execute in a predictable order:

  1. Before Aspects - Authentication, validation, rate limiting
  2. Around Aspects - Caching, transactions, timing
  3. After Aspects - Logging, response modification

Inherited Aspects

Build controller hierarchies with shared crosscutting concerns:

Contextual Services

Use different implementations based on context:

CLI Commands

Canvas includes a command-line interface called Sculpt for managing your application:

Route Management

Task Scheduler Management

Asset Publishing

Canvas provides a powerful asset publishing system to deploy configuration files, templates, and other resources:

Why Canvas?

Contributing

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

Reporting Issues

Contributing Code

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Follow PSR-12 coding standards
  4. Add tests for new functionality
  5. Update documentation for new features
  6. Submit a pull request

License

Canvas is open-sourced software licensed under the MIT license.


All versions of canvas with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
ext-mysqli Version *
ext-pdo Version *
ext-curl Version *
ext-gd Version *
ext-fileinfo Version *
monolog/monolog Version *
quellabs/contracts Version ^1.
quellabs/support Version ^1.
quellabs/discover Version ^1.
quellabs/dependency-injection Version ^1.
quellabs/sculpt Version ^1.
quellabs/cache Version ^1.
quellabs/signal-hub Version ^1.
quellabs/canvas-smarty Version ^1.
quellabs/annotation-reader Version ^1.
symfony/http-foundation Version *
dragonmantank/cron-expression Version *
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 quellabs/canvas contains the following files

Loading the files please wait ....