Expand description
Editorial social cards and blog covers for Laravel Rust: SVG templates rendered natively, image templates drawn without any SVG, text fitted with real font metrics, and backgrounds that can be a flat colour, an Unsplash photo or an image you generated somewhere else.
ⓘ
Card::make("why-agents-are-more-than-a-model")
.template("post")
.data(json!({
"category_label": "DESARROLLO",
"title": "Por que un agente de IA es mucho mas que llamar a un modelo",
"author_name": "Edu Lazaro",
}))
.output(public_path("img/blog/why-agents.png"))
.generate(false)
.await?;It is the port of the PHP package edulazaro/laracards to
Laravel Rust 0.1 (beta), and its API follows the framework’s changes until 1.0.
Re-exports§
pub use backgrounds::LocalBackground;pub use backgrounds::NullBackground;pub use backgrounds::UnsplashBackground;pub use card::Card;pub use card::IntoBackground;pub use config::Align;pub use config::Anchor;pub use config::Backgrounds;pub use config::FitRule;pub use config::Format;pub use config::Highlight;pub use config::LaracardsConfig;pub use config::Paths;pub use config::Renderers;pub use config::Resvg;pub use config::Stack;pub use config::TemplateConfig;pub use config::Unsplash;pub use contracts::Background;pub use contracts::CardSource;pub use contracts::Renderer;pub use exceptions::RenderFailed;pub use generator::CardGenerator;pub use provider::LaracardsServiceProvider;pub use renderers::ResvgRenderer;pub use sources::CardSources;pub use support::Color;pub use support::DataUri;pub use support::ImageComposer;pub use support::Manifest;pub use support::Raster;pub use support::Template;pub use support::Text;pub use support::TextFitter;
Modules§
- backgrounds
- Where the picture behind a card comes from.
- card
- config
- console
- contracts
- The contracts a card is made of: where its background comes from, how it is drawn, and where cards come from.
- exceptions
- generator
- provider
- renderers
- How an SVG becomes pixels.
- sources
- support
- The pieces a card is made of: colour parsing, data URIs, the manifest, template substitution and text fitting.
- templates
- The example template, the one
laracards:publishwrites.
Functions§
- generator
- The card generator of the running application.
- source
- Register a card source for
cards:generatewhile the application runs. This is how another package hands its cards to Laracards: call it from its provider’sboot, which runs after everyregister. PHP adds the class tolaracards.sourcesinstead. - sources
- The sources
cards:generatewalks.