Download the PHP package krak/svg without Composer
On this page you can find all versions of the php package krak/svg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package svg
Short Description A library used for manipulating and creating svg
License MIT
Homepage http://gitlab.bighead.net/bighead/krak-svg
Informations about the package svg
Svg
Krak Svg is a library for creating and exporting svg.
Installation
`
Design & Usage
The Svg library is broken up into several components: Visitors, Iterators, Serializers, and Element.
Building an Svg Tree
``
Serializing an Svg Tree
``
The StringSerializer will export the tree into svg tree.
The RsvgCliSvgSerializer uses the rsvg
command line utility to export an svg to a png, pdf, ps or any other format supported by rsvg. This serializer requires a string serializer thought to convert it to a string first.
Iteratoring an Svg Tree
``
We currently support to types of iterators: Top down and bottom up. The functional iterators are implemented as generators traversing the svg tree iteratively (as apposed to recursively). The iterator classes are just wrappers around the functional iterator generators.
- Top Down: Starts from the top of the tree and outputs on the way down.
- Bottom Up: Starts from the bottom of the tree and prints the lowest nodes first and works it's way up.
Element Model
The element model is made up of Elements and Attributes. Each Element as an AttributeCollection
which can hold Attributes. Most attributes are just SimpleAttriutes, but there are some special attributes that can be created and set per element.
Elements can also have hints which are just meta data associated with an element.
Visitors and Walkers
Visitors and walkers are a way for modifying the svg tree before serializing it.
- AttributeString Visitor: Converts an elements attributes into a string
- HeightCalculator Visitor: Calculates the height of an svg element by summing the height of all of it's child elements. It only applies height calculation on elements with the query hint of
Krak\Svg\Visitor\HeightCalculatorVisitor::HINT
value.