<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>

CC BY-SA 4.0
2023-04-22T05:36:13.940Z
2023-04-22T05:36:13.940Z
msbit
<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>

CC BY-SA 4.0
2022-07-26T08:53:07.533Z
Thanks, the shell appears to work already, but the change isn't reflected when I open up the CMS in my browser.
Plum Duffer
CC BY-SA 4.0
2022-07-26T09:28:55.680Z
Try it with the interactive shell? See my updated answer.
Ben Croker
CC BY-SA 4.0
2022-07-26T10:00:54.400Z
Yep, have done all this and it's still not working.
Plum Duffer
CC BY-SA 4.0
2022-07-26T07:34:29.013Z
2022-07-26T09:33:55.260Z
2022-07-26T09:33:55.260Z
Ben Croker
<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>

<cli><craft4>
How to programmatically enable Pro trial in Craft 4?
# 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:
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:
php craft project-config/set system.edition pro

Other project-config subcommands may be handy as well, such as:
php craft project-config/diff

to show any pending changes made to the on-disk configuration, and
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:

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:
echo 'Craft::$app->setEdition(Craft::Pro)' | php craft shell


Perhaps test with the interactive shell to see if it works and go from there?

> **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.  

---

