1000 search results

Dynamic Groups without Caching

…And... that's fine! Symfony handles all of that behind the scenes. In the case of the resource metadata factory, API Platform itself decorates that service multiple times... each "layer" adding a bit more functionality. Normally, when we decorate a service from our application, our…

10:34
Resetting the Database Between Tests

…how can we empty the database before each test? There are a few answers, but one common one you'll see in the API Platform world is called Alice. Find your terminal and install it with: composer require "alice:^2.7" --dev This will install…

4:51
ACL: Only Owners can PUT a CheeseListing

…Ok, let's fix this! The access_control option - which will probably be renamed to security in API Platform 2.5 - allows you to write an "expression" inside using Symfony's expression language. This is_granted() thing is a function that's available in that…

9:23
Creating the User Entity

…gorgeous new Doctrine entity... but as far as API Platform is concerned, we still only have one API resource: CheeseListing. Next: let's expose User as an API Resource and use all of our new knowledge to perfect that new resource in... about 5 minutes.

5:07
Calling the Controller & View Event

…model". Then, you could write a listener to this event that transforms that Article entity into HTML by rendering the template. This event isn't used anywhere in Symfony's core, but it is used extensively inside API Platform. Internally, their controllers return objects. Then…

5:20
FrameworkBundle Recipe Part 2: The Kernel Class

…adopted by most browsers. We talk more about it inside our API Platform Security tutorial - but this setting shouldn't cause problems in most setups and is definitely more secure. So let's say "y" for all of these changes. Keep going! Now we're…

8:37
Microservices Gone Wrong

…ve all gone out and built systems. And a team that I had the opportunity to lead a number of years ago, we wound up building a platform. And I'm gonna tell you a little about the background. But we made a bunch of…

39:20
Publishing a Listing

…waiting for our cheese. So... how should we design this in our API? You might think that we need a custom endpoint or "operation" in ApiPlatform language. Something like POST /api/cheeses/{id}/publish. You can do this. And we'll talk about custom operations…

6:02
Custom Logic Only for some Operations

…which operation is being used. But if you start also using a PATCH operation or custom operations, then this would not be enough. Like many parts of ApiPlatform, a data persister has a normal interface - DataPersisterInterface: But also an optional, stronger interface that gives you…

5:02
PropertyFilter: Sparse Fieldsets

…about a protocol that adds features to your web server. It was created by the API Platform team, and if we scroll down a bit, they have a really good example. Pretend that we have the following API. If we make a request to /books…

6:55
Passing Values to Stimulus

…a small percentage of your users to be susceptible to CSRF attacks. If you want to learn more, our API Platform 2 tutorial has a whole chapter on SameSite cookies and CSRF tokens. Next, let's turn to the other authentication use-case: API tokens.

4:32
Serializing Messages as JSON

…property into JSON. We're not going to go too deep into Symfony's serializer component, but if you want to know more, we go much deeper in our API Platform Tutorial. Anyways, this simple JSON structure is something any other system could understand. So..…

6:41
DTO Quirks

…just delete it so that the tests will pass. But good news! Thanks to the API Platform team, this bug has been fixed and should be released in API Platform 2.5.8. But since that hasn't been released yet at the time of…

5:23
Query Extension: Auto-Filter a Collection

…for a specific resource or even for a specific operation of a resource. They're... basically... awesome. Let's get our extension going: in the src/ApiPlatform/ directory, create a new class called CheeseListingIsPublishedExtension. Make this implement QueryCollectionExtensionInterface and then go to the Code ->…

9:37
Head first into Symfony Cache, Redis & Redis Cluster (Andre Rømcke)

…application. So in our case on the eZ Platform side, we did change this to make sure we could take advantage of looking up several things at the same time. Instead of us having our API where you load one thing at the same time…

37:44
Knowing your State Machines

…I'm sorry, show him or her later. Quick about me. I do plenty of work on Happyr. We are a job advert platform - it matches people with confidence, blah blah. I do plenty of Symfony things. I run PHP meetups in Stockholm and I…

45:03
Back to the Basics (Symfony local Web Server)

…then you can get started really easily. The problem is that it comes with many limitations and I'm going to talk about that in minute. Docker, well may be slow depending on the platform, especially on a Mac. I mean it is for me…

31:36
Decoration: Override Core Services & AsDecorator

…wild? The answer to that is... sort of all over! In API Platform, it's common to use decoration to extend core services like the ContextBuilder. And Symfony itself uses decoration pretty commonly to add debugging features while we're in the dev environment. For…

9:56
The await Keyword

…It's not very important in this case, but I'm actually going to use this @id instead. This is called an "IRI" - it's a unique key that API Platform adds to every resource. It's... just more useful than a database ID or…

7:34
Prime Time with Messenger: Queues, Workers & more Fun! (Ryan Weaver)

API Platform integration. That's not really new, but that's just once you get used to messenger, like there's a really good way to make, not really a custom operation, but let's say a custom operation on API Platform where when you…

44:36