---
title: "Installing TinyMCE with Composer"
description: "Learn how to install TinyMCE from Packagist using Composer."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/php-projects/"
md_url: "https://www.tiny.cloud/docs/tinymce/7/php-projects/index.md"
version: "7"
last_updated: "2026-06-04T01:51:09Z"
tokens: 1256
---
Important This page documents TinyMCE 7. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../latest/php-projects/).
# Installing TinyMCE with Composer

## Install TinyMCE using the Composer package manager

TinyMCE 7 is a powerful and flexible rich text editor that can be embedded in web applications. This quick start covers how to add a TinyMCE editor to a web page using the Composer package manager.

To add TinyMCE to a PHP project using Composer, run the following on a command line:

```sh
composer require tinymce/tinymce
```
The location of the main TinyMCE script will be: `vendor/tinymce/tinymce/tinymce.min.js`. Ensure the `tinymce` directory containing the `tinymce.min.js` file is accessible for the target page or application by either:

- Using a webserver route, or
- Copying the `tinymce` directory to a public folder using a build tool.

To deploy TinyMCE from a .zip archive:

1. Download TinyMCE.

  - For Self-hosted Enterprise customers, visit [Tiny - Self-hosted releases](/get-tiny/self-hosted/)
  - For the self-hosted TinyMCE community edition, visit [Tiny Account - Downloads](/my-account/downloads/)
2. Unzip the archive into a public folder of your webserver, such as:

```sh
unzip tinymce_latest.zip -d /path/to/webserver/public/
```
The location of the main TinyMCE script will be: `/path/to/webserver/public/tinymce/js/tinymce/tinymce.min.js`.

## Include the TinyMCE script

Include the following line of code in the `<head>` of an HTML page.

```html
<script src="/path/or/uri/to/tinymce.min.js" referrerpolicy="origin"></script>
```

## Initialize TinyMCE as part of a web form

Initialize TinyMCE 7 on any element (or elements) on the web page by passing an object containing a `selector` value to `tinymce.init()`. The `selector` value can be any valid [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors).

For example: To replace `<textarea id="mytextarea">` with a TinyMCE 7 editor instance, pass the selector `'#mytextarea'` to `tinymce.init()`.

For example:

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script src="/path/or/uri/to/tinymce.min.js" referrerpolicy="origin"></script>
    <script>
      tinymce.init({
        selector: '#mytextarea',
        license_key: 'gpl|<your-license-key>'
      });
    </script>
  </head>

  <body>
    <h1>TinyMCE Quick Start Guide</h1>
    <form method="post">
      <textarea id="mytextarea">Hello, World!</textarea>
    </form>
  </body>
</html>
```
Adding this content to an HTML file and opening it in a web browser will load a TinyMCE editor, such as:

**Example**

```js
tinymce.init({
  selector: 'textarea#default'
});
```

## Setting the license

### Use TinyMCE with the GPLv2+ license

If the developer intends to self-host TinyMCE under the GPL license, they can set the `license_key` config option to 'gpl'. Case sensitivity does not matter.

#### Example

```js
tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  license_key: 'gpl'
});
```

### Use TinyMCE with a commercial license

If the developer intends to self-host TinyMCE under a commercial license, a valid license key must be provided. Customers who have purchased a self-hosted-eligible license for TinyMCE will find their license key in the [account portal](/auth/login/). To purchase a commercial license, see available options on the [pricing page](/pricing/).

#### Example

```js
tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  license_key: '<your-license-key>'
});
```
For more information on licensing, see the [License Key](../license-key/) guide.

## Save the content from the editor

To retrieve content from the editor, either process the content with a form handler or use the [getContent API](../apis/tinymce.editor/#getContent).

If you use a form handler, once the `<form>` is submitted, TinyMCE 7 will `POST` the content in the same way as a normal HTML `<textarea>`, including the HTML elements and inline CSS of the editor content. The host’s form handler can process the submitted content in the same way as content from a regular `<textarea>`.

## Next Steps

For information on:

- Customizing TinyMCE, see: [Basic Setup](../basic-setup/).
- The three editor modes, see:

  - [TinyMCE classic editing mode](../use-tinymce-classic/).
  - [TinyMCE inline editing mode](../use-tinymce-inline/).
  - [TinyMCE distraction-free editing mode](../use-tinymce-distraction-free/).
- Adding TinyMCE plugins, see: [Work with plugins to extend TinyMCE](../work-with-plugins/).
- Localizing the TinyMCE editor, see: [Localize TinyMCE](../localize-your-language/).
- For information on the CSS required to render some TinyMCE elements outside of the editor, see: [CSS for rendering TinyMCE content outside the editor](../editor-content-css/).
