Download the PHP package hudsxn/canvas without Composer

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

A lightweight, performant PHP framework for building server-rendered and hybrid web applications with a focus on flexibility, security, and developer experience.

Overview

Canvas provides a structured approach to building web pages through a tree-based component system, decoupled rendering architecture, and comprehensive response handling. It solves common problems in modern PHP web development while maintaining simplicity and performance.

Core Problems Solved

1. Rendering Flexibility

Traditional PHP frameworks often tightly couple your application logic to a specific templating engine. Canvas solves this by providing a renderer contract that allows you to choose your preferred rendering approach:

Switch between rendering strategies without changing your application code. Simply swap the renderer implementation.

2. Performance Optimization

Canvas includes several performance-critical features:

Array-Based String Building Instead of using string concatenation (which creates new string buffers on each operation), Canvas uses numerically-indexed arrays for HTML generation. This approach is significantly faster for large HTML outputs:

Automatic Gzip Compression Built-in content negotiation and gzip compression can reduce HTML payload sizes by 70-90%, significantly improving page load times. Compression level is configurable from 1 (fastest) to 9 (maximum compression).

Bitwise Flags Page configuration flags (caching, indexing, security) use bitwise operations instead of individual boolean properties, reducing memory usage and providing faster flag checks.

3. Security by Default

Canvas makes it easy to implement security best practices:

Configure comprehensive security policies in a few lines:

4. SEO and Metadata Management

Centralized management of document metadata, Open Graph tags, Twitter Cards, and search engine directives:

5. Separation of Concerns

Canvas enforces clean architecture through separation:

This separation makes testing easier, code more maintainable, and allows different parts of your application to evolve independently.

Architecture

Node System

The Node class provides a flexible tree structure for representing UI components or document elements. Each node contains:

Nodes can be searched, traversed, and manipulated programmatically:

Canvas (Root Container)

Canvas extends Node to represent the complete document, adding template information:

Page (Document Configuration)

Page combines a Canvas with complete document metadata and behavioral rules:

Renderer (Pluggable Rendering)

Implement the CanvasPageRenderer interface to define how pages are rendered:

Response (HTTP Delivery)

Response handles the complete HTTP response lifecycle:

Performance Features

Efficient String Building

Using array-based string building avoids the performance penalty of repeated string concatenation. For large HTML documents, this can provide significant performance improvements.

Configurable Compression

Gzip compression with configurable levels (1-9) allows you to balance compression ratio against CPU usage based on your needs:

Bitwise Flag Operations

Page flags use bitwise operations for efficient storage and fast checks:

Security Features

Content Security Policy

Fluent API for building CSP directives:

Automatic Security Headers

Response automatically generates security headers:

HTTPS Enforcement

Built-in support for forcing HTTPS connections:

Use Cases

Traditional Server-Rendered Applications

Use Canvas with your preferred template engine (Blade, Twig, plain PHP) for traditional server-side rendering with enhanced performance and security features.

Single Page Applications

Canvas includes a built-in SinglePageApplicationRenderer for SPAs with full control over assets and state injection:

The SPA renderer generates a minimal HTML shell with:

Multiple Asset Support:

Hybrid Applications

Combine server-side rendering with client-side hydration for optimal performance and SEO:

  1. Server renders initial HTML
  2. Canvas state serialized to JSON
  3. Client-side framework hydrates from JSON

Static Site Generation

Pre-render pages to static HTML files:

Getting Started

Installation

Basic Example

Quick Start: Single Page Application

Canvas includes a production-ready SPA renderer:

The client-side app can access the state:

Implementing a Renderer

Design Philosophy

Canvas is built on several key principles:

Flexibility Over Convention: Choose your own rendering approach, template engine, and architecture. Canvas provides structure without imposing rigid conventions.

Performance by Default: Built-in optimizations like array-based string building and gzip compression mean you get good performance without extra effort.

Security by Design: Making security features easy to use encourages their adoption. CSP configuration should be as simple as method chaining.

Separation of Concerns: Clear boundaries between structure (Node), metadata (Page), rendering (Renderer), and transport (Response) make code more maintainable and testable.

Progressive Enhancement: Start simple and add features as needed. Use basic rendering or add compression, security headers, and advanced CSP as your application grows.

Batteries Included: While remaining flexible, Canvas includes a production-ready SinglePageApplicationRenderer so you can start building immediately without boilerplate.

Bundled Renderer

SinglePageApplicationRenderer

A production-ready renderer for React, Vue, Angular, and other client-side frameworks.

Features:

Configuration Options:

Generated HTML Structure:

Advanced Usage:

License

MIT License - see LICENSE file for details.


All versions of canvas with dependencies

PHP Build Version
Package Version
No informations.
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 hudsxn/canvas contains the following files

Loading the files please wait ...