Atelier SVG
SVG Toolkit for PHP
- Runtime
- PHP 8.3+
- Dependencies
- None
- Tests
- 4 000+
- Coverage
- 100%
- PHPStan
- Level 10
- Standard
- SVG 1.1
Everything SVG, in PHP
Document
Parse existing files, create from scratch, validate structure, sanitize uploads
Elements
Every SVG element as a typed object. Query with CSS selectors, traverse the tree
Paths
Build curves, compute geometry, simplify segments, boolean operations
Styling
Read and write inline styles, compute transforms, resolve layout
Optimization
40+ passes that clean, shrink, and simplify. Custom pipelines, batch processing
Morphing
Interpolate between any two shapes. Export as SMIL, CSS, JS, or sprite sheets
Guides & Use Cases
Step-by-step recipes for the most common SVG workflows in PHP.
Sanitize Uploads
Accept SVGs from users without risking XSS. Strip scripts, event handlers, and dangerous content, then validate and optimize before serving.
Batch Optimize
Optimize an entire directory of SVG files in a build step or CI pipeline using configurable optimization passes.
Working with Groups
Use groups to scope transforms, share attributes, and structure complex SVG documents.
Build Charts
Generate SVG charts and data visualizations programmatically in PHP. Compose bar charts, add accessible metadata, and combine layouts.
Creating Icons
Build accessible, optimized SVG icons - viewBox setup, currentColor, accessibility annotations, and production export.
Sprite Sheets
Combine multiple SVG icons into a single sprite using <symbol> and <use> to reduce HTTP requests and keep icons consistent across your app.
Animate Shapes
Morph between two SVG shapes and export self-contained animated SVGs with configurable easing, frame count, and timing.
Accessibility
Audit and fix SVG accessibility: add titles, descriptions, and ARIA roles so SVGs work correctly with screen readers and assistive technology.
Merge SVG Documents
Combine multiple SVG documents into one using merge strategies, or import individual elements between documents.
Convert Shapes to Paths
Convert SVG shape elements - rect, circle, ellipse, line, polygon, polyline - to path elements for animation, morphing, and further optimization.
Place Markers Along a Path
Distribute markers, dots, or labels evenly along an SVG path using getPointAtLength() - for trails, routes, and animation guides.
Crop SVG to its Content
Trim an SVG's viewBox and dimensions to fit its actual content, removing whitespace from third-party files or after deleting elements.
Community
Free and MIT licensed. Contributions of all kinds are welcome, from bug reports to pull requests.