Download the PHP package yohns/legal-pages without Composer

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

yohns/legal-pages

Generate customizable legal pages (Privacy Policy, Terms of Service, etc.) from Markdown templates with placeholder substitution — outputs Markdown or Bootstrap 5.3.8 HTML.

Getting Started

1. Install via Composer:

2. Publish starter files:

This copies a config file, a quickstart script, and an optional web UI into a legal-pages/ directory in your project root.

3. Edit your config and generate:

Output files (Markdown + Bootstrap HTML) are saved to legal-pages/generated/.

Publish Options

Programmatic Usage

Output Formats

Markdown (generate())

Returns raw Markdown with all placeholders replaced and conditional sections processed.

Bootstrap HTML Fragment (convertToHtml())

Returns HTML with Bootstrap 5.3.8 CSS classes on elements. No <html>, <head>, or <body> tags — just the content ready to embed in your existing page.

Bootstrap classes applied:

Element Classes
<h1> - <h6> mb-3
<p> mb-2
<table> table table-striped
<ul>, <ol> ps-3
<blockquote> blockquote ps-3 border-start border-4
<a> link-primary
<hr> my-4

Full HTML Page (convertToHtml(full: true))

Returns a complete HTML document with the Bootstrap 5.3.8 CDN stylesheet included. Ready to save and open in a browser.

The page title is derived from the page type (e.g., privacy-policy becomes Privacy Policy).

Saving Files (savePage())

Save generated content to any directory. The directory is created automatically if it doesn't exist.

Parameters:

Available Templates

Base Templates (all website types)

Page Type Template File
privacy-policy legal/base/privacy-policy.md
terms-of-service legal/base/terms-of-service.md
cookie-policy legal/base/cookie-policy.md
dmca-policy legal/base/dmca-policy.md
accessibility-statement legal/base/accessibility-statement.md

Website-Specific Templates

Website Type Template
personal legal/personal/blog-disclaimer.md
ecommerce legal/ecommerce/refund-policy.md
ecommerce legal/ecommerce/shipping-policy.md
social legal/social/content-policy.md

Template resolution order:

  1. legal/{websiteType}/{pageType}.md (website-specific)
  2. legal/base/{pageType}.md (fallback)

List Available Templates

Website Types

Pass the website type as the second constructor parameter:

The website type controls:

Placeholders

Templates use {{category:field}} syntax. Pass values via the constructor or setter methods.

Via Constructor (nested array)

Via Constructor (flat format)

Via Setter Methods

Auto-Populated Placeholders

When yohns/config is configured with config/config.php, these placeholders are filled automatically:

Placeholder Config Key
company:name company_name
company:address company_address
company:email contact_email
company:phone contact_phone
company:country company_country
website:url site_url
website:name site_name
current:date Auto (today)
current:year Auto (this year)

Common Placeholder Categories

Category Fields
company name, legal_name, email, phone, address, city, state, zip, country
website url, name, domain
data collected, cookies, retention, sharing, location
compliance gdpr, ccpa, coppa, ada, dpa_email
feature newsletter, analytics, medical_content, legal_content
ecommerce payment_processors, shipping_providers, return_period, shipping_time, refund_time
social content_policy, minimum_age, reporting, account_termination, content_rights

See legal/placeholders/cheat-sheet.md for the complete reference.

Conditional Sections

Templates support conditional blocks based on website type or feature/compliance flags:

Enable compliance flags via placeholders:

Custom Template Directory

By default, templates are loaded from legal/ relative to the package root. Pass a custom path as the 4th constructor parameter:

Your custom directory should follow the same structure:

Config Integration

This package uses yohns/config to auto-load site defaults. Set up your config files:

config/config.php — Core site/company values (loaded first, available to other configs):

config/legal-pages.php — Legal-specific defaults, compliance flags, and page-specific placeholders:

These values are automatically used as placeholder defaults. Values passed to the constructor override config values.

Using Content Without Saving Files

You can use the generator to get content directly as PHP variables without writing any files. This is useful when you want to embed legal pages in your own templates, serve them dynamically, or store them in a database.

To generate multiple pages without saving files, set $outputDir to false and collect the results:

Full Example: Generate All Legal Pages

Testing

License

MIT


All versions of legal-pages with dependencies

PHP Build Version
Package Version
Requires yohns/config Version ^1.2
league/commonmark Version ^2.7
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 yohns/legal-pages contains the following files

Loading the files please wait ...