Answers.Body: <p>After a bit of noodling around, I figured out it's as simple as:</p>
  <pre class="lang-bash prettyprint-override"><code>php craft project-config/set system.edition pro
  </code></pre>
  <p>Other <code>project-config</code> subcommands may be handy as well, such as:</p>
  <pre class="lang-bash prettyprint-override"><code>php craft project-config/diff
  </code></pre>
  <p>to show any pending changes made to the on-disk configuration, and</p>
  <pre class="lang-bash prettyprint-override"><code>php craft project-config/apply
  </code></pre>
  <p>to apply them.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-22T05:36:13.940Z
Answers.LastActivityDate: 2023-04-22T05:36:13.940Z
Answers.UserDisplayName: msbit
Answers.Body: <p>You'll need to have the <code>yiisoft/yii2-shell</code> package installed to run <code>craft shell</code>.</p>
  <p>From the <a href="https://craftcms.com/docs/4.x/console-commands.html#shell" rel="nofollow noreferrer">Craft docs</a>:</p>
  <blockquote>
  <p>This command requires the yiisoft/yii2-shell package, which you may need to add to your project:<br />
  <code>composer require --dev yiisoft/yii2-shell</code></p>
  </blockquote>
  <p>Then this command should work:</p>
  <pre class="lang-sh prettyprint-override"><code>echo 'Craft::$app-&gt;setEdition(Craft::Pro)' | php craft shell
  </code></pre>
  <p><a href="https://i.sstatic.net/ACBlS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ACBlS.png" alt="enter image description here" /></a></p>
  <p>Perhaps test with the interactive shell to see if it works and go from there?</p>
  <p><a href="https://i.sstatic.net/0VKEs.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0VKEs.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-26T08:53:07.533Z
Answers.Text: Thanks, the shell appears to work already, but the change isn't reflected when I open up the CMS in my browser.
Answers.UserDisplayName: Plum Duffer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-26T09:28:55.680Z
Answers.Text: Try it with the interactive shell? See my updated answer.
Answers.UserDisplayName: Ben Croker
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-26T10:00:54.400Z
Answers.Text: Yep, have done all this and it's still not working.
Answers.UserDisplayName: Plum Duffer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-26T07:34:29.013Z
Answers.LastActivityDate: 2022-07-26T09:33:55.260Z
Answers.LastEditDate: 2022-07-26T09:33:55.260Z
Answers.UserDisplayName: Ben Croker
Body: <p>In Craft 3, I setup a base build for my team which had a bash script. At one point in the script I was able to enable a Craft Pro trial license like so:</p>
  <pre class="lang-bash prettyprint-override"><code>echo 'Craft::$app-&gt;setEdition(Craft::Pro)' | php craft shell/index
  </code></pre>
  <p>However, this doesn't work in a version I am doing for Craft 4, and I can't find any changelog or notes about this being removed in Craft 4.</p>
  <p>Anyone know if this is intended to happen now? (As in, Craft 4 is supposed to prevent the interactive shell from making changes to a site)</p>
  <p>If it is supposed to happen, what could be another solution to get this working?</p>
  
Tags: <cli><craft4>
Title: How to programmatically enable Pro trial in Craft 4?
ThreadText: # How to programmatically enable Pro trial in Craft 4?
  
  (Asked by: username_0 on 2022-07-26)
  
  In Craft 3, I setup a base build for my team which had a bash script. At one point in the script I was able to enable a Craft Pro trial license like so:
  
  ```bash
  echo 'Craft::$app->setEdition(Craft::Pro)' | php craft shell/index
  
  ```
  
  However, this doesn't work in a version I am doing for Craft 4, and I can't find any changelog or notes about this being removed in Craft 4.
  
  Anyone know if this is intended to happen now? (As in, Craft 4 is supposed to prevent the interactive shell from making changes to a site)
  
  If it is supposed to happen, what could be another solution to get this working?
  
  **Tags:** cli, craft4
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2023-04-22. Score: 2
  
  After a bit of noodling around, I figured out it's as simple as:
  
  ```bash
  php craft project-config/set system.edition pro
  
  ```
  
  Other `project-config` subcommands may be handy as well, such as:
  
  ```bash
  php craft project-config/diff
  
  ```
  
  to show any pending changes made to the on-disk configuration, and
  
  ```bash
  php craft project-config/apply
  
  ```
  
  to apply them.
  
  
  ---
  
  ### Answer by username_2 on 2022-07-26. Score: 1
  
  You'll need to have the `yiisoft/yii2-shell` package installed to run `craft shell`.
  
  From the [Craft docs](https://craftcms.com/docs/4.x/console-commands.html#shell):
  
  > This command requires the yiisoft/yii2-shell package, which you may need to add to your project:  
  > `composer require --dev yiisoft/yii2-shell`
  
  Then this command should work:
  
  ```sh
  echo 'Craft::$app->setEdition(Craft::Pro)' | php craft shell
  
  ```
  
  [![enter image description here](https://i.sstatic.net/ACBlS.png)](https://i.sstatic.net/ACBlS.png)
  
  Perhaps test with the interactive shell to see if it works and go from there?
  
  [![enter image description here](https://i.sstatic.net/0VKEs.png)](https://i.sstatic.net/0VKEs.png)
  
  > **Comments:**
  > **username_0**: Thanks, the shell appears to work already, but the change isn't reflected when I open up the CMS in my browser.  
  > **username_2**: Try it with the interactive shell? See my updated answer.  
  > **username_0**: Yep, have done all this and it's still not working.  
  
  ---
  
  