- How do I install gosuperscript/schema in a Laravel application?
- Install it with Composer using composer require gosuperscript/schema. If the package ships a Laravel service provider, Laravel's package auto-discovery should register it; otherwise add the provider manually as described in the README. Publish any config file if the package provides one, then build your first schema object and render it as JSON-LD.
- Which Laravel and PHP versions does gosuperscript/schema support?
- Support depends on the package's composer.json constraints, so check those before upgrading Laravel or PHP. Because the package is a PHP library for generating Schema.org data, it may work across multiple Laravel versions as long as the PHP requirement is met. Run your test suite on the exact Laravel and PHP versions you deploy to confirm compatibility.
- How do I render JSON-LD structured data in a Blade template?
- Build the schema object in a controller, view composer, or dedicated service, then serialize it to JSON. In Blade, output it inside a script tag with type application/ld+json. Use the package's JSON output method and Blade's raw output syntax carefully so the JSON is not HTML-escaped.
- What Schema.org types can I generate with gosuperscript/schema?
- The package is aimed at common SEO markup such as Article, Product, Organization, and BreadcrumbList, with a fluent PHP API for building entities. Check the README for the exact builders and properties exposed in your version. For types not covered, you can usually compose the equivalent JSON-LD manually or extend the package's builders.
- Can I output multiple structured data objects on the same page?
- Typically yes: you can render multiple script blocks or combine entities in a single graph. Build each schema separately and render them together, or nest related entities such as an Organization and its WebSite. Confirm the package's preferred graph or array syntax in its documentation.
- How should I test Schema.org JSON-LD generated by this package?
- Write feature tests that request the page, extract the application/ld+json block, and decode it with json_decode to assert the expected @type and properties. Also validate representative output with Google's Rich Results Test and the Schema.org validator. Keep fixture tests for required fields like headline, image, and author on Article markup.
- Is gosuperscript/schema suitable for production use?
- It can be, but evaluate release activity, license, issue responsiveness, and whether the API is stable before relying on it for SEO-critical output. Pin the version in composer.json and upgrade deliberately. Because structured data failures are often silent, add tests that assert your key schema types and required properties.
- How do I customize the JSON-LD output or add custom properties?
- Use the package's fluent setters to add standard Schema.org properties, and check whether it exposes a generic type or property method for less common fields. If you need a custom builder, extend the package's classes or wrap generation in your own service so the rest of the app depends on your API. Keep custom output validated against Schema.org requirements.
- What are alternatives to gosuperscript/schema for Laravel Schema.org markup?
- spatie/schema-org is a widely used PHP package for building Schema.org objects, and many teams also hand-write arrays and json_encode them for simple cases. Choose based on the schema types you need, Laravel integration, maintenance activity, and how much control you want over the final JSON-LD. For a few static pages, manual JSON-LD is often simpler.
- Does gosuperscript/schema handle escaping and special characters in JSON-LD?
- JSON serialization should escape quotes, backslashes, and control characters correctly, which is why you should use the package's encoder rather than string concatenation. When rendering in Blade, avoid escaping the JSON as HTML but ensure user-supplied values cannot break out of the script tag. Test with titles and descriptions containing quotes, ampersands, and Unicode characters.