1
1
# Playground
2
+
2
3
A space to learn and experience CodeIgniter 4
3
4
4
5
[ ![ ] ( https://github.com/codeigniter4projects/playground/workflows/PHPUnit/badge.svg )] ( https://github.com/codeigniter4projects/playground/actions/workflows/test.yml )
@@ -8,78 +9,84 @@ A space to learn and experience CodeIgniter 4
8
9
9
10
This playground is here to help you learn CodeIgniter 4 by example. We try to cover use cases for the most
10
11
common tasks you'll find yourself doing in web applications. Where there are multiple ways to do something,
11
- we've tried to give examples of doing things in each way.
12
+ we've tried to give examples of doing things in each way.
12
13
13
14
This isn't meant to replace [ the docs] ( https://codeigniter4.github.io/CodeIgniter4/index.html ) . This is just
14
- something to look at to get a deeper understanding, or to better see how something could be done in practice.
15
+ something to look at to get a deeper understanding, or to better see how something could be done in practice.
15
16
16
17
## Resources
17
18
18
- There are two primary ways to learn about what's going on here in the Playground. The first is the code itself.
19
- We've heaped a LOT of comments throughout the code. They're your best docs. So explore them in depth.
20
- Additionally, there's a small collection of docs in the conveniently named [ docs] ( docs ) folder.
19
+ There are two primary ways to learn about what's going on here in the Playground. The first is the code itself.
20
+ We've heaped a LOT of comments throughout the code. They're your best docs. So explore them in depth.
21
+ Additionally, there's a small collection of docs in the conveniently named [ docs] ( docs ) folder.
21
22
22
- To setup a working playground on your own local device, read through the next section.
23
+ To setup a working playground on your own local device, read through the next section.
23
24
24
- ## Getting Started
25
+ ## Getting Started
25
26
26
27
In order to get the playground setup on your own computer, you'll need a few minimum requirements - all of which
27
28
are listed on [ CodeIgniter's repo] ( https://github.com/codeigniter4/CodeIgniter4#server-requirements ) . Basically,
28
- as long as you are running PHP 7.2 or later you'll meet most of them.
29
+ as long as you are running PHP 7.2 or later you'll meet most of them.
29
30
30
- While CodeIgniter does not require it, using this repo also requires the use of
31
- [ Composer] ( https://getcomposer.org/ ) to install CodeIgniter as a dependency, and PHPUnit - the test framework.
31
+ While CodeIgniter does not require it, using this repo also requires the use of
32
+ [ Composer] ( https://getcomposer.org/ ) to install CodeIgniter as a dependency, and PHPUnit - the test framework.
32
33
You don't need that installed globally, and we actually recommend against it, since different projects likely
33
- require different versions of PHPUnit installed as time goes on and it can become tricky maintain a local
34
- environment that works with all of the different versions.
34
+ require different versions of PHPUnit installed as time goes on and it can become tricky maintain a local
35
+ environment that works with all of the different versions.
35
36
36
37
While it can be downloaded as a zip and extracted, we'll use [ git] ( https://git-scm.com/ ) to manage things.
37
38
38
- With those out of the way, it only takes a few small steps to get the project up and running locally.
39
+ With those out of the way, it only takes a few small steps to get the project up and running locally.
39
40
40
41
1 - Clone the repo if you haven't already, from the CLI:
41
42
42
- git clone https://github.com/codeigniter4projects/playground
43
+ git clone https://github.com/codeigniter4projects/playground
43
44
44
45
That creates a new directory, ` playground ` , under your current directory.
45
46
46
47
2 - Enter the new directory and install the project dependencies with Composer. NOTE: The command shown
47
48
here assumes that you have Composer loaded globally. If you don't, then pretend we're using ` composer.phar ` .
49
+
48
50
```
49
51
cd playground
50
52
composer install
51
53
```
52
54
53
55
3 - Copy ` .env.example ` in the project directory and name it ` .env ` . Then open it up and verify the settings:
54
56
55
- * First, ` CI_ENVIRONMENT ` is set to ` development ` as this enables error handling, the debug toolbar, and some other
56
- things handy while in development.
57
+ - First, ` CI_ENVIRONMENT ` is set to ` development ` as this enables error handling, the debug toolbar, and some other
58
+ things handy while in development.
59
+
60
+ - Next make sure that ` app.baseURL ` matches whatever you are currently running your site at. If you use ` spark ` ,
61
+ then it already matches the default. If this doesn't match, then generated links might not work, and your
62
+ developer toolbar will never show up.
57
63
58
- * Next make sure that ` app.baseURL ` matches whatever you are currently running your site at. If you use ` spark ` ,
59
- then it already matches the default. If this doesn't match, then generated links might not work, and your
60
- developer toolbar will never show up.
64
+ - Finally while you're in there, you can edit your database settings, though you can do that in ` app/Config/Database.php `
65
+ just as easily. Since we won't deploy this to multiple servers it's no big deal to edit the config files directly.
61
66
62
- * Finally while you're in there, you can edit your database settings, though you can do that in ` app/Config/Database.php `
63
- just as easily. Since we won't deploy this to multiple servers it's no big deal to edit the config files directly.
67
+ 4 - Back on the command line, we install all of the needed database tables and sample data.
64
68
65
- 4 - Back on the command line, we install all of the needed database tables and sample data.
66
69
```
67
70
php spark migrate
68
71
php spark db:seed PlaygroundSeeder
69
72
```
70
73
71
74
5 - That's it! If you're hosting through Apache, Nginx, etc, then head to your site. If you just want a quick
72
- way to work with your site locally, go back to the CLI and start up ` spark ` , CodeIgniter's small server.
75
+ way to work with your site locally, go back to the CLI and start up ` spark ` , CodeIgniter's small server.
73
76
74
- php spark serve
77
+ php spark serve
75
78
76
- If you get would like to change the port it's running on, that's no problem:
79
+ If you get would like to change the port it's running on, that's no problem:
77
80
78
- php spark serve --port 8081
81
+ php spark serve --port 8081
79
82
80
- Enjoy!
83
+ Enjoy!
81
84
82
85
## Code Challenges
83
86
84
- There are some portions of the code intentionally left for * you * to finish. Once you are familiar with
87
+ There are some portions of the code intentionally left for _ you _ to finish. Once you are familiar with
85
88
the project and have read through the docs try searching the code for anything with the comment ** Help!** .
89
+
90
+ ## Images
91
+
92
+ All images in this repo were created by MidJourney and are can be used freely in non-commercial use cases.
0 commit comments