Download the PHP package decmuc/svgsanitizer without Composer

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

SvgSanitizer

PHP License: MIT

SvgSanitizer is a lightweight PHP library that validates SVG files or fragments and blocks potentially harmful code like JavaScript, embedded objects, inline event handlers, or suspicious Base64 payloads. It helps protect your application from XSS and injection attacks via SVG uploads.


SvgSanitizer ist eine kompakte PHP-Bibliothek zur Prüfung von SVG-Dateien oder -Inhalten. Sie erkennt und blockiert potenziell schadhaften Code wie JavaScript, eingebettete Objekte, Inline-Handler oder verdächtige Base64-Payloads. Damit schützt sie deine Anwendung vor XSS- oder Injektionsangriffen durch manipulierte SVGs.


📦 Installation

English

Use Composer to add the package:

Deutsch

Füge die Bibliothek über Composer hinzu:

⚙️ Autoloading

English

Make sure Composer's autoload is enabled:

Deutsch

Stelle sicher, dass Composer's Autoload aktiviert ist:`

🚀 Usage / Nutzung

English

Use the SvgSanitizer class to check if an SVG is safe. Example:

Deutsch

Verwende die Klasse SvgSanitizer, um zu prüfen, ob ein SVG sicher ist. Beispiel:

🔧 Methods / Methoden

⚠️ Example Error Handling / Beispielhafte Fehlermeldungen

English

SvgSanitizer checks SVG content on three levels: First, known exploit patterns are reliably detected and immediately blocked using a blacklist. Next, the SVG is validated and cleaned based on a strict whitelist of allowed tags and attributes. Finally, special rules are applied to styles and embedded data to eliminate hidden risks.

Only SVGs that pass all checks are accepted and returned.

Deutsch

SvgSanitizer prüft SVG-Inhalte auf drei Ebenen: Zunächst werden bekannte Exploit-Muster mit einer Blacklist zuverlässig erkannt und sofort blockiert. Anschließend wird das SVG anhand einer strengen Whitelist zulässiger Tags und Attribute geprüft und bereinigt. Abschließend werden spezielle Regeln auf Styles und eingebettete Daten angewendet, um auch versteckte Gefahrenquellen auszuschließen.

Nur SVGs, die alle Prüfungen bestehen, werden akzeptiert und ausgegeben.

📝 License / Lizenz

English

This project is licensed under the MIT License. See LICENSE for details.

Deutsch

Dieses Projekt ist unter der MIT-Lizenz lizenziert. Siehe LICENSE für Details.


All versions of svgsanitizer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 decmuc/svgsanitizer contains the following files

Loading the files please wait ...