Skip to content

Commit f831556

Browse files
committed
Proofread pages
Test instruction with some random pages
1 parent f71e410 commit f831556

5 files changed

Lines changed: 36 additions & 39 deletions

File tree

app/pages/6.0/02.background/01.introduction/docs.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
---
22
title: Introduction
33
description: The PHP community has evolved considerably over the past decade, and this breakneck pace has caused a lot of people to get left behind. UserFrosting aims to help new and legacy developers navigate the overwhelming ocean of tools, packages, and concepts in PHP and the modern web development community as a whole.
4-
obsolete: true
54
---
65

76
## Motivation
87

9-
The PHP community has evolved considerably over the past decade, beginning with PHP5's support for object-oriented programming in 2006, to the first meetings of [PHP-FIG](http://www.php-fig.org/) to develop a [set of standards for PHP code](http://www.phptherightway.com/#code_style_guide), to the release of Composer as the _de facto_ package manager in 2012. At the same time the web development community as a whole has been changing, with websites becoming more dependent on Javascript and CSS to provide sophisticated client-side features. And Javascript has moved even faster!
8+
The PHP community has evolved considerably over the past two decades, beginning with PHP 5's support for object-oriented programming in 2004, to the first meetings of [PHP-FIG](http://www.php-fig.org/) to develop a [set of standards for PHP code](http://www.phptherightway.com/#code_style_guide), to the release of Composer as the _de facto_ package manager in 2012. At the same time, the web development community as a whole has been changing, with websites becoming more dependent on JavaScript and CSS to provide sophisticated client-side features. And JavaScript has moved even faster!
109

11-
This breakneck pace has caused a lot of people to get left behind. For someone who hasn't been doing web development continuously for the past ten years, it can feel like a hopeless task to try and get acquainted with all of the new tools and frameworks that seem to be coming out every day. Relevant comic from [Abstruse Goose](http://abstrusegoose.com/503):
10+
This breakneck pace has caused a lot of people to get left behind. For someone who hasn't been doing web development continuously for the past decade or more, it can feel like an overwhelming task to get acquainted with all of the new tools and frameworks that seem to be coming out every day. Relevant comic from [Abstruse Goose](http://abstrusegoose.com/503):
1211

13-
![BlooP and FlooP and GlooP](images/theoretical_mathematics_however_never_goes_out_of_fashion.png?resize=500)
12+
![BlooP and FlooP and GlooP](/images/theoretical_mathematics_however_never_goes_out_of_fashion.png)
1413

15-
The problem is that when you're a busy developer with a lot of Real-Life (tm) projects to work on, it's very difficult to set aside time to read a book about technology X - especially when you're not even sure that you really _need_ to learn X!
14+
The problem is that when you're a busy developer with real-world projects to work on, it's very difficult to set aside time to read a book about technology X - especially when you're not even sure that you really _need_ to learn X!
1615

1716
UserFrosting has a better idea. Instead of learning about these technologies as a purely academic exercise, you'll work on one of _your_ projects, and learn what you need as you go!
1817

1918
## What exactly will I learn?
2019

21-
There are three main categories that UserFrosting attempts to cover: software architecture, tools of the trade, and best practices. Most of the PHP developers we see in chat or on Stack Overflow are behind in at least one these areas:
20+
There are three main categories that UserFrosting attempts to cover: software architecture, tools of the trade, and best practices. Most of the PHP developers we see in chat or on Stack Overflow are behind in at least one of these areas:
2221

2322
### Software architecture
2423

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Web Dev, the Right Way
33
description: "UserFrosting has a not-so-secret ulterior motive: to get you to become a better developer."
4-
obsolete: true
54
---
65

76
#### Chapter 2
@@ -10,4 +9,4 @@ obsolete: true
109

1110
UserFrosting has a not-so-secret ulterior motive: **to get you to become a better developer**.
1211

13-
In this chapter, we'll talk about the state of modern web development tools and practices, and clear up some common misconceptions about how web applications actually work. Then, we'll go over key security concepts. Finally, we'll discuss best practices to make sure that users will be able to find and use your application when it's finished.
12+
In this chapter, we'll talk about the state of modern web development tools and practices, and clear up some common misconceptions about how web applications actually work. Then, we'll go over key security concepts. Finally, we'll discuss best practices to make sure that users will be able to find and use your application when it's finished.

app/pages/6.0/07.dependency-injection/01.concept/docs.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ $owl1 = new Owl($nest);
6262
$owl2 = new Owl($improvedNest);
6363
```
6464

65-
But how can an owl be sure it's receiving a *nest*, and not a *dog house*? That's where **Interfaces** comes into play. If both `Nest` and `ImprovedNest` implements a `NestInterface` Interface, then the *Owl* can be sure it will receive the proper object :
65+
But how can an owl be sure it's receiving a *nest*, and not a *dog house*? That's where **Interfaces** come into play. If both `Nest` and `ImprovedNest` implement a `NestInterface` interface, then the *Owl* can be sure it will receive the proper object:
6666

6767
```php
6868
interface NestInterface
@@ -97,16 +97,16 @@ class Owl
9797

9898
public function getNestSize(): string
9999
{
100-
$this->nest->getSize();
100+
return $this->nest->getSize();
101101
}
102102
}
103103
```
104104

105-
In the above example, it doesn't matter if `Owl` received a `Nest` or an `ImprovedNest`, or even a `SuperDuperNest`, as long as they all obey the same definition defined by the `NestInterface`. Moreover, the Owl class can confidently call the `getSize` method of the injected `$nest` property, because the interface makes sure that method is available, no matter which implementation of the `NestInterface` it receives.
105+
In the above example, it doesn't matter if `Owl` receives a `Nest` or an `ImprovedNest`, or even a `SuperDuperNest`, as long as they all obey the same contract defined by the `NestInterface`. Moreover, the `Owl` class can confidently call the `getSize()` method of the injected `$nest` property, because the interface ensures that method is available, no matter which implementation of the `NestInterface` it receives.
106106

107-
Using interfaces to declare what kind of object a class is expected to receive, even if you don't plan to have multiple "nest" types, is a key element in *Autowiring* that we'll see shortly.
107+
Using interfaces to declare what kind of object a class is expected to receive, even if you don't plan to have multiple "nest" types, is a key element in *autowiring* that we'll see shortly.
108108

109109
This is of course a contrived example, but the general strategy of keeping your classes loosely coupled is a good way to make your code more reusable and easily tested.
110110

111111
> [!TIP]
112-
> You can learn more, and see other examples, on the [PHP-DI Website : Understanding Dependency Injection](https://php-di.org/doc/understanding-di.html).
112+
> You can learn more, and see other examples, on the [PHP-DI Website: Understanding Dependency Injection](https://php-di.org/doc/understanding-di.html).

app/pages/6.0/07.dependency-injection/04.adding-services/docs.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ obsolete: true
66

77
You'll probably want to create your own services to modularize certain aspects of your own project. For example, if your application needs to interact with some third-party API like Google Maps, you might create a `MapBuilder` class that encapsulates all of that functionality. This is a cleaner and more manageable alternative to simply stuffing all of your code directly into your controller classes.
88

9-
If you want to use a single instance of `MapBuilder` throughout your application, you'll probably end up defining it as a service. To do this, you'll need to create a new `MapBuilderService` class in your site sprinkle and register it in your [Sprinkle Recipe](sprinkles/recipe#services).
9+
If you want to use a single instance of `MapBuilder` throughout your application, you'll probably end up defining it as a service. To do this, you'll need to create a new `MapBuilderService` class in your site sprinkle and register it in your [Sprinkle Recipe](sprinkles/recipe#services).
1010

11-
You can actually create one big service provider for all your services, but it's best to create different provider classes for each service. This makes it easier to test and debug each of your services. It also makes things easier if you need to extend or disable a service in another sprinkle down the road. With this setup, each service resides in its own provider class instead of the global `ServiceProvider` class. For example :
11+
You can actually create one big service provider for all your services, but it's best to create different provider classes for each service. This makes it easier to test and debug each of your services. It also makes things easier if you need to extend or disable a service in another sprinkle down the road. With this setup, each service resides in its own provider class instead of the global `ServiceProvider` class. For example:
1212

1313
```
1414
app
@@ -23,7 +23,7 @@ app
2323

2424
First, we'll create the service class. This class **must** implement the `UserFrosting\ServicesProvider\ServicesProviderInterface` interface. It must contain the `register` method, which returns an array of [service definitions](dependency-injection/the-di-container#service-providers-definitions).
2525

26-
**app/src/ServicesProvider/MapBuilderService.php**:
26+
**app/src/ServicesProvider/MapBuilderService.php**
2727

2828
```php
2929
<?php
@@ -41,12 +41,12 @@ use UserFrosting\Sprinkle\Site\GoogleMaps\MapBuilder;
4141
*/
4242
class MapBuilderService implements ServicesProviderInterface
4343
{
44-
public function register(): array
44+
public function register(): array
4545
{
4646
return [
4747
MapBuilder::class => function () {
4848
// Do what you need before building the object
49-
...
49+
// ...
5050

5151
// Now, actually build the object
5252
$mapBuilder = new MapBuilder(...);
@@ -61,10 +61,9 @@ class MapBuilderService implements ServicesProviderInterface
6161
> [!TIP]
6262
> You'll notice that we've added `use UserFrosting\Sprinkle\Site\GoogleMaps\MapBuilder;` to the top of the file. This means that we don't have to use the fully qualified class name (with the entire namespace) every time we want to refer to the `MapBuilder` class.
6363
64-
If you need to pull in another service, for example the config to retrieve an API key, you can add them as the parameter, and the dependency injector will automatically pick it up.
64+
If you need to pull in another service, for example the config to retrieve an API key, you can add it as a parameter, and the dependency injector will automatically pick it up.
6565

6666
```php
67-
...
6867
MapBuilder::class => function (Config $config) {
6968
$apiKey = $config['api.key'];
7069

@@ -73,14 +72,14 @@ MapBuilder::class => function (Config $config) {
7372

7473
return $mapBuilder;
7574
},
76-
...
7775
```
7876

7977
### Register your service
8078

8179
The next step is to tell UserFrosting to load your service in your [Sprinkle Recipe](sprinkles/recipe#getservices). To do so, you only need to list all the service providers you want to automatically register inside the `$getServices` property of your sprinkle class :
8280

83-
**app/src/MyApp.php** :
81+
**app/src/MyApp.php**
82+
8483
```php
8584
<?php
8685

0 commit comments

Comments
 (0)