Download the PHP package akram-zaitout/laravel-katex without Composer
On this page you can find all versions of the php package akram-zaitout/laravel-katex. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download akram-zaitout/laravel-katex
More information about akram-zaitout/laravel-katex
Files in akram-zaitout/laravel-katex
Package laravel-katex
Short Description A comprehensive Laravel package for rendering beautiful mathematical expressions using KaTeX
License MIT
Informations about the package laravel-katex
Laravel KaTeX
A comprehensive, production-ready Laravel package for rendering beautiful mathematical expressions using KaTeX. Native PHP implementation with dependency injection, following Laravel best practices.
β¨ Features
- οΏ½ Flexible & Intuitive - Use it your way with Blade directives, components, or our Facadeβwhatever fits your coding style.
- π Secure by Design - We handle XSS protection and validation automatically so you can render user content with peace of mind.
- βοΈ Fully Customizable - Tweak delimiters, error handling, and macros globally or on the fly to match your specific needs.
- π Blazing Fast - Optimized rendering ensures your mathematical expressions load instantly without slowing down your app.
- π§ͺ Production Ready - Built with a comprehensive test suite and strict typing to ensure reliability in mission-critical applications.
π Requirements
- PHP 7.2 or higher
- Laravel 6.0 or higher
- ext-json
π¦ Installation
Install the package via Composer:
Publish Configuration (Optional)
This creates config/katex.php where you can customize all aspects of the package.
Publish Views (Optional)
π Quick Start
Basic Setup
In your Blade layout file (e.g., resources/views/layouts/app.blade.php):
Using Blade Directives
π Usage
1. Blade Directives
@katexStyles
Renders the KaTeX CSS stylesheet:
@katexScripts
Renders KaTeX JavaScript with optional configuration:
@katex
Renders inline mathematical expressions:
@katexBlock
Renders display mode (block) mathematical expressions:
2. Facade
Use the Katex facade for programmatic access:
3. Helper Functions
4. Blade Component
5. Service Injection
βοΈ Configuration
Environment Variables
Set these in your .env file:
Configuration File
Publish and edit config/katex.php:
π Local Asset Management (Offline Support)
This package supports downloading KaTeX assets to your local application, allowing you to run without external CDN dependencies. This is perfect for offline environments, intranets, or strict privacy compliance/GDPR.
1. Download Assets
Run the artisan command to download CSS, JS, and font files to public/vendor/katex:
You can also specify a specific version:
2. Enable Local Assets
Update your .env file to tell the package to use the local files:
Or configure it in config/katex.php:
π Examples
π Security
XSS Protection
All user input is automatically escaped using Laravel's e() helper:
Subresource Integrity
SRI hashes ensure CDN files haven't been tampered with:
Trust Settings
By default, \url and \href commands are disabled. Enable only if needed:
π License
This package is open-sourced software licensed under the MIT license.
Made with β€οΈ by Akram Zaitout
All versions of laravel-katex with dependencies
illuminate/support Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/contracts Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
ext-json Version *