Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Archive for Wrzesień, 2015

SitePoint PHP Blog: Demystifying RegEx with Practical Examples

SitePoint PHP Blog: Demystifying RegEx with Practical Examples

On the SitePoint PHP blog they’ve posted a tutorial from author Nicola Pietroluongo that wants to help demystify regular expressions with a few more real-world examples. He doesn’t teach the foundations of regular expressions here and instead opts for a more "cookbook" approach with lots of little examples.

A regular expression is a sequence of characters used for parsing and manipulating strings. They are often used to perform searches, replace substrings and validate string data. This article provides tips, tricks, resources and steps for going through intricate regular expressions.

He starts with some basic tips around creating good regular expressions for your application: knowing the scenario you’re matching, planning the requirements and implementing the match itself. His example expressions include matching for:

  • simple passwords matching a policy
  • valid URL matching
  • HTML tag patterns
  • finding duplicated words

Each example comes with the regular expression itself and an explanation of how it’s doing the matching, breaking it down into each piece of the regex puzzle and how it relates to the match overall.

Source: http://www.phpdeveloper.org/news/23195

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

SitePoint PHP Blog: Demystifying RegEx with Practical Examples

SitePoint PHP Blog: Demystifying RegEx with Practical Examples

On the SitePoint PHP blog they’ve posted a tutorial from author Nicola Pietroluongo that wants to help demystify regular expressions with a few more real-world examples. He doesn’t teach the foundations of regular expressions here and instead opts for a more "cookbook" approach with lots of little examples.

A regular expression is a sequence of characters used for parsing and manipulating strings. They are often used to perform searches, replace substrings and validate string data. This article provides tips, tricks, resources and steps for going through intricate regular expressions.

He starts with some basic tips around creating good regular expressions for your application: knowing the scenario you’re matching, planning the requirements and implementing the match itself. His example expressions include matching for:

  • simple passwords matching a policy
  • valid URL matching
  • HTML tag patterns
  • finding duplicated words

Each example comes with the regular expression itself and an explanation of how it’s doing the matching, breaking it down into each piece of the regex puzzle and how it relates to the match overall.

Source: http://www.phpdeveloper.org/news/23195

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Ewan Valentine: Designing Domain Specific Language

Ewan Valentine: Designing Domain Specific Language

In a post to his site Ewan Valentine looks at some considerations to think about when creating a domain specific language in your applications. This kind of language helps define common terms, conventions and practices for developers to follow in their code.

When you spin up a framework such as Laravel, Symfony etc. The first thing you’ll notice, is that they have their own ‘feel’. I often joke that Symfony2 is like Java and Laravel is like Ruby.

But what gives an application or a framework a ‘feel’? Domain specific language or ‘DSL’. Domain specific language is almost like a syntax or a language specific to your application and ecosystem. DSL is what makes your applications code unique and more usable.

He gives a specific example of a Laravel application he was creating and how he wanted the interface to function, transforming the result of a find() into a JSON response. He shows how it could actually be done but that introduces more maintenance and more code to cover. Instead he worked backwards into the domain context the request was operating in and found an ideal injection point for transformation that would keep it out of the controller action itself.

So, to design usable domain specific syntax, start at the front. In other words the part you’ll be writing the most, and then work backwards to abstract the logic and make it actually work.

Source: http://www.phpdeveloper.org/news/23194

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Ewan Valentine: Designing Domain Specific Language

Ewan Valentine: Designing Domain Specific Language

In a post to his site Ewan Valentine looks at some considerations to think about when creating a domain specific language in your applications. This kind of language helps define common terms, conventions and practices for developers to follow in their code.

When you spin up a framework such as Laravel, Symfony etc. The first thing you’ll notice, is that they have their own ‘feel’. I often joke that Symfony2 is like Java and Laravel is like Ruby.

But what gives an application or a framework a ‘feel’? Domain specific language or ‘DSL’. Domain specific language is almost like a syntax or a language specific to your application and ecosystem. DSL is what makes your applications code unique and more usable.

He gives a specific example of a Laravel application he was creating and how he wanted the interface to function, transforming the result of a find() into a JSON response. He shows how it could actually be done but that introduces more maintenance and more code to cover. Instead he worked backwards into the domain context the request was operating in and found an ideal injection point for transformation that would keep it out of the controller action itself.

So, to design usable domain specific syntax, start at the front. In other words the part you’ll be writing the most, and then work backwards to abstract the logic and make it actually work.

Source: http://www.phpdeveloper.org/news/23194

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Ewan Valentine: Designing Domain Specific Language

Ewan Valentine: Designing Domain Specific Language

In a post to his site Ewan Valentine looks at some considerations to think about when creating a domain specific language in your applications. This kind of language helps define common terms, conventions and practices for developers to follow in their code.

When you spin up a framework such as Laravel, Symfony etc. The first thing you’ll notice, is that they have their own ‘feel’. I often joke that Symfony2 is like Java and Laravel is like Ruby.

But what gives an application or a framework a ‘feel’? Domain specific language or ‘DSL’. Domain specific language is almost like a syntax or a language specific to your application and ecosystem. DSL is what makes your applications code unique and more usable.

He gives a specific example of a Laravel application he was creating and how he wanted the interface to function, transforming the result of a find() into a JSON response. He shows how it could actually be done but that introduces more maintenance and more code to cover. Instead he worked backwards into the domain context the request was operating in and found an ideal injection point for transformation that would keep it out of the controller action itself.

So, to design usable domain specific syntax, start at the front. In other words the part you’ll be writing the most, and then work backwards to abstract the logic and make it actually work.

Source: http://www.phpdeveloper.org/news/23194

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Matt Stauffer: Environment-Specific Configuration for CraftCMS Using PHPDotEnv

Matt Stauffer: Environment-Specific Configuration for CraftCMS Using PHPDotEnv

In this post to his site Matt Stauffer shows a more real-word example of how the phpdotenv library can make configuration of your application simpler. He shows how it can be applied to a Craft CMS installation to manage domain-specific configuration details.

Craft is a fantastic CMS, but every CMS shows some pain points when you have a large team working on the same site at the same time. One of these points for me is Craft’s native multi-environment configuration options, which allow you to define configuration options based on the domain name.

[...] This is great, but it’s limited: You’re hard-coding the configuration details into your code, which sometimes means putting sensitive information into your version control. Every developer’s local installs either all have to have different domains, or if they use the same domain they need to all have the same configuration settings. And something just feels dirty about the codebase having such knowledge of every place it’s going to be deployed.

He introduces the phpdotenv library and how you define its simple .env file with a basic INI structure. He then shows how to add the phpdotenv library to your installation:

  • adding it to the list of Composer installed libraries
  • update your front controller to load the configuration
  • define the .env file with your settings
  • ignore it via .gitignore

With these steps in place you can then update the Craft configuration with calls to getenv in all the right places to pull items from the phpdotenv configuration.

Source: http://www.phpdeveloper.org/news/23193

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Matt Stauffer: Environment-Specific Configuration for CraftCMS Using PHPDotEnv

Matt Stauffer: Environment-Specific Configuration for CraftCMS Using PHPDotEnv

In this post to his site Matt Stauffer shows a more real-word example of how the phpdotenv library can make configuration of your application simpler. He shows how it can be applied to a Craft CMS installation to manage domain-specific configuration details.

Craft is a fantastic CMS, but every CMS shows some pain points when you have a large team working on the same site at the same time. One of these points for me is Craft’s native multi-environment configuration options, which allow you to define configuration options based on the domain name.

[...] This is great, but it’s limited: You’re hard-coding the configuration details into your code, which sometimes means putting sensitive information into your version control. Every developer’s local installs either all have to have different domains, or if they use the same domain they need to all have the same configuration settings. And something just feels dirty about the codebase having such knowledge of every place it’s going to be deployed.

He introduces the phpdotenv library and how you define its simple .env file with a basic INI structure. He then shows how to add the phpdotenv library to your installation:

  • adding it to the list of Composer installed libraries
  • update your front controller to load the configuration
  • define the .env file with your settings
  • ignore it via .gitignore

With these steps in place you can then update the Craft configuration with calls to getenv in all the right places to pull items from the phpdotenv configuration.

Source: http://www.phpdeveloper.org/news/23193

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

That Podcast: Episode 22: The one where we’re in London again

That Podcast: Episode 22: The one where we’re in London again

That Podcast, hosted by PHP community members Beau Simensen and Dave Marshall has posted their latest episode today – Episode #22: The one where we’re in London again (…because it is symfony live London time again!).

Beau and Dave get together at Symfony Live London for a quick catch up and chat with Matthias Noback. Sorry about audio quality, there’s a bit of mic handling and swapping going on as we’re out on location!

Topics mentioned include:

You can listen to this latest episode either through the in-page audio player or by downloading the mp3 directly. Be sure to subscribe to their feed or follow them on Twitter for more information about the latest episodes as they’re released.

Source: http://www.phpdeveloper.org/news/23192

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

That Podcast: Episode 22: The one where we’re in London again

That Podcast: Episode 22: The one where we’re in London again

That Podcast, hosted by PHP community members Beau Simensen and Dave Marshall has posted their latest episode today – Episode #22: The one where we’re in London again (…because it is symfony live London time again!).

Beau and Dave get together at Symfony Live London for a quick catch up and chat with Matthias Noback. Sorry about audio quality, there’s a bit of mic handling and swapping going on as we’re out on location!

Topics mentioned include:

You can listen to this latest episode either through the in-page audio player or by downloading the mp3 directly. Be sure to subscribe to their feed or follow them on Twitter for more information about the latest episodes as they’re released.

Source: http://www.phpdeveloper.org/news/23192

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Site News: Popular Posts for This Week (09.25.2015)

Site News: Popular Posts for This Week (09.25.2015)

Popular posts from PHPDeveloper.org for the past week:

Source: http://www.phpdeveloper.org/news/23191

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>