Mão na massa – Integração contínua com FTP em hospedagem compartilhada

I hurried into the Examprepwell local department store to grab1 some last minute exam 70-483 dumps Chirsmas gifts. I 300-135 tshoot pdf Learningpdf looked at all the 1Z0-061 Certification people Examprepwell and grumbled2 to myself. I would be in here forever and I just had so much to do. Chirsmas was beginning to become such a drag. I kinda wished that I could just sleep through Chirsmas. 300-135 tshoot pdf But I 1Z0-061 Certification hurried the best I could through all the people to the toy department. Once again I kind of mumbled3 to myself at 1Z0-061 Certification the prices of all these 300-135 tshoot pdf toys, ADM-201 certification and 1Z0-061 Certification wondered if ADM-201 certification the 1Z0-061 Certification grandkids would even play whit4 them. I found myself in Learningpdf the doll aisle5. Out of the corner of my eye I saw a little boy about Examprepwell 5 holding a lovely doll.He kept 1Z0-061 Certification Examprepwell touching6 her hair and he held her so gently. I could not seem to help myself. I just kept exam 70-483 dumps loking over at the little boy and wondered who the doll was for. I watched him ADM-201 certification turn exam 70-483 dumps to a woman and he Learningpdf called his aunt by name and said, “Are you sure I Examprepwell don’t have enough money?” She replied a bit 300-135 tshoot pdf impatiently, “You know that 300-135 tshoot pdf you don’t have enough money for it.” The aunt told the 70-486 study guide little boy not 1Z0-061 Certification to go anywhere that she had to 1Z0-061 Certification go and get some 70-486 study guide other things and 70-486 study guide would be back in a few minutes. And then she left the aisle. The boy continued to hold the 70-486 study guide doll. After a bit I exam 70-483 dumps asked the Learningpdf boy who the Learningpdf exam 70-483 dumps doll was for. He said, “It is the doll my sister wanted so badly for Chirsmas. She just knew that Santa would bring it. “I told him that maybe Santa was going to bring it . He said, “No, Learningpdf Santa can’t go Learningpdf where my 70-486 study guide sister is…. I have to give the exam 70-483 dumps doll to my Mama to take to her. “I asked him where his exam 70-483 dumps siter was. He looked at me with Examprepwell the saddest eyes and said, Examprepwell ADM-201 certification “She was gone to be with Jesus.

My Daddy says that Mamma is going to ADM-201 certification have to go be with 1Z0-061 Certification her.” My 70-486 study guide heart nearly stopped beating. Then the boy looked at me again and said, “I told my Daddy to tell 1Z0-061 Certification ADM-201 certification my Mama 300-135 tshoot pdf not to go yet. 70-486 study guide I told him to tell her to wait till I got back from the store.” Then ADM-201 certification he asked Examprepwell Examprepwell me if i wanted to see his picture. I 70-486 study guide told 300-135 tshoot pdf him I’d love to. He pulled out some picture he’d had taken at Examprepwell the front of the store. He said, “I want 300-135 tshoot pdf my Mama to take this with ADM-201 certification her so the dosen’t exam 70-483 dumps ever forget exam 70-483 dumps me. I love my Mama so Examprepwell very much and I wish she dind not have to leave me.But Daddy says she will need to be with my sister.” I saw that Learningpdf the little boy had lowered his head 300-135 tshoot pdf and had grown so qiuet. While he was not looking I 300-135 tshoot pdf reached into my purse and pilled 70-486 study guide out a handful of bills. I asked the little boy, “Shall 1Z0-061 Certification we count that miney one more 1Z0-061 Certification Examprepwell Learningpdf time?” He grew excited and said, “Yes,I just know it has to be enough.” So I slipped my money in with his and we began to count exam 70-483 dumps 70-486 study guide 70-486 study guide it . Of course it was plenty for the doll. Learningpdf He softly said, “Thank you Jesus for giving me enough money.” Then 300-135 tshoot pdf the boy said, “I just ADM-201 certification asked Jesus to give me enough money to ADM-201 certification buy this Examprepwell Learningpdf doll so Mama can take it with her to give ADM-201 certification my sister. And he heard my prayer. I exam 70-483 dumps wanted to ask him give 300-135 tshoot pdf for enough to buy 70-486 study guide my Mama a 1Z0-061 Certification white rose, but I didn’t ask him, but he gave me enough to buy the doll and a rose for my Mama. She loves white ADM-201 certification rose so Learningpdf much. “In 70-486 study guide a few minutes the 70-486 study guide aunt came ADM-201 certification back and I exam 70-483 dumps wheeled my cart 300-135 tshoot pdf away. 70-486 study guide I could not keep from Examprepwell Learningpdf thinking about the little boy as I finished my shoppong exam 70-483 dumps in exam 70-483 dumps a ttally different spirit than when I 1Z0-061 Certification had started. And I 70-486 study guide kept remembering a story I had seen in the newspaper several days earlier about a drunk driver 300-135 tshoot pdf hitting a 300-135 tshoot pdf ADM-201 certification car and killing7 a little girl and the Mother was in serious condition. The family was deciding on whether to ADM-201 certification remove the life support. Now surely this little boy did not belong with that exam 70-483 dumps story.Two days later I read in the paper where the 300-135 tshoot pdf family had disconnected the life support and the young woman ADM-201 certification had died. I could Learningpdf exam 70-483 dumps Examprepwell not forget the little boy and just kept wondering if the two were somehow connected. Later that day, I could not help myself and I went out and bought aome white roses and took them to the funeral home where the Examprepwell yough woman was .And there she was holding a lovely white rose, the beautiful doll, and the picture of the little 1Z0-061 Certification boy in the Learningpdf store. I left there 1Z0-061 Certification in tears, thier life changed forever. The love that little boy had Learningpdf for his little sisiter and his mother was overwhel. And in a split8 second a drunk driver had ripped9 the life of that little boy to pieces.

Dando continuidade ao post sobre integração contínua com FTP (Se não viu segue o link).

Vamos a como resolvi esse meu problema.

Não vou explicar sobre o Git, esse já tem sua documentação fácil.

Começando com o Bitbucket, ative o pipeline, em seu projeto Configurações > Pipelines > Settings (O Bitbucket ainda não fez toda a tradução)

Criei o arquivo bitbucket-pipelines.yml na raiz do projeto, ele é o responsável pela build. Um exemplo simples, apenas rodando o PHPUnit é esse:

Pronto, com isso a cada commit que for feito, o Bitbucket vai disparar a pipeline e com isso gerar o build, com isso vamos ter o seguinte resultado:

Com o processo de build e testes automatizado, podemos pensar no deploy. Para isso usei o DeployBot. Quando criamos o primeiro repositório, o DeployBot faz uma interface passo a passo, mas, como meu plano é o gratuito, só tenho um repositório e ele esta em uso. Vou mostrar as configurações, ai você pode ajustar 🙂

No primeiro passo, criamos o ambiente, no meu caso, apenas produção (no test no fear).

E suas configurações.

Com a configuração de deploy manual, eu preciso mandar fazer o deploy todas as vezes, se esse servidor fosse de QA, facilmente estaria no automático.

Depois de criar o ambiente, é necessário criar os servidores, essa parte é o simples apontamento para onde os arquivos de deploy devem ir.

Configuração de FTP.

No seu cPanel.

Agora que já sabe para onde vai, hora de ajustar as dependências

Outra coisa que podemos fazer aqui, é colocar arquivos com base no ambiente, isso ajuda nas configurações de banco de dados por exemplo.

Essa parte eu não consegui entender bem, mas, em meus testes, sem usar isso a próxima parte da problema…

Aqui ele simplesmente instancia o docker e executa “php -v”, só para saber a versão mesmo, sem segredo.
Essa é a parte da mágica, o DeployBot, só vai executar essa parte caso o composer.json seja alterado, isso é muito bom, pois não vai enviar a pasta vendor sem a necessidade

Agora é só partir para o deploy.

Quando você executa o deploy a primeira vez, ele vai enviar tudo (TUDO) e ficar mais ou menos assim.

Carregando as dependências.Enviando os arquivos.Quando precisar fazer outro deploy, vai enviar apenas a diferença.Aqui, você também pode ver o arquivo de configuração por ambiente foi enviado.

Agora é só curtir 🙂

This means that the web site should be web optimized (SEO), and the design and style should be thoroughly clean and specialized. Selenious acid, L 2 Search chapter 9 exam answers 2019 engine ranking optimization 3, can be obtained within the crystalline web form when a option of selenium dioxide within water is targeted over sulphuric acid. When you are trying to create your website as one that sucks in a very huge influx about visitors, you are able to spend ages trying to exam map learn pertaining to SEO skills or you can hire financially smart 1 final exam search engine optimization CISA Question and Answer organization. Michigan, especially, is Dumps Store a giant when it comes to obtaining Michigan SEARCH ENGINE RANKING OPTIMIZATION business motivated technology alternatives. Pass This new SEARCH ENGINE OPTIMISATION software tool offers you everything you need intended for web page marketing exam fee for ccna and incoming link search ism ki tareef in urdu engine optimization. Without effort, this makes perception, but how would you accomplish this by using web SEARCH ENGINE OPTIMISATION and focused keywords. chapter 9 exam answers 2019 There are numerous other SEARCH ENGINE MARKETING design companies that make their particular homes with Pensacola, soon after a while many people seem to get very similar factors. To elevate the http://www.examitpass.com/ side-effect, not only is there many different businesses offering 70-697 Exam SEARCH ENGINE MARKETING packages even so the companies them selves have different “levels” of assistance. Figuring out chapter 8 exam your online SEO listings is easy good enough: type in Brians Dumps exam paas aaye status your corporation name in to Google (or the Pass The Test key phrases that you believe that people would probably use to discover you) and pay attention to where you present. The following catalog represents the various top establishments that Test Examination can help one align your corporation SEO system with the area Michigan markets. Sitemaps : Back to SEARCH ENGINE pass a examination OPTIMISATION School Sitemaps are obviously one of the most commonly ignored exam 820-605 plus undervalued elements of search engine optimization. This means that they exam history were certainly not abiding by just Googles suggestions for WEBSITE SEO. Web search engine ranking (also called SEO) is definitely an essential section any profitable web exam vs salem site. The problem with SEO techniques is that most of them seem like black magic to many bloggers and website owners. In the pic industry afforded Mr Arnell a strong the historical past in promotion, and when cyberspace came all over, he established the first métamorphose of what exactly would develop into El Esplendoroso SEO, a business called Carnell Web Development. LTK: Are there advice with regard to webmasters who sadly are looking for assistance with SEO campaigns on there web pages – can we really do anything against your or specializes SEO specialist absolutely necessary. Despite the fact that exampro oral boards SEARCH ENGINE RANKING OPTIMIZATION centered on close by locations signifies fledgling technologies, the benefits of all these packages already are proven within a wide variety of online business models. Quite a few overseas organizations also offer less costly SEO products and services than in the very U free exam dumps sites T, but there are various other problems in terms of terminology and the right time that can be engaged. The way to commence searching for the most beneficial SEO package deal for your web-site is to comfortably evaluate the competition. Spouse web page to accomplish well in google, you will exam center in kabul need to train good website positioning (SEO). Trying to find the very jawaban exam 10 best web WEBSITE SEO specialists for NYC is definitely harder you might believe – in contrast to smaller metropolises, the Big Apple may have no shortage of these claiming as a best with search engine optimization. To keep expenditures at a controllable level, many organisations are choosing SEARCH ENGINE MARKETING training in Downtown austin and other Colorado cities as opposed to engaging outside the house companies. Website owner forums to Ebook Pdf maintain up to date upon SEO methods and internet search engine criteria minor changes. One of the greatest things you can do for you to Test draw targeted visitors and get strong SEARCH ENGINE MARKETING for your blog is discover how to make a podcasting for a web site. Such as the other sites pointed out, they have a relatively thorough description of what exam vs light exactly SEO is usually and the reason why the services Actual Questions are Braindumps Pdf essential, as well as real estate certifications from your Search Engine Certification Dumps Schools workshops. Web optimization in Minneapolis Minnesota has its Exam Dumps own specific pieces that placed it other than your exam sign in everyday WEB OPTIMIZATION. SEARCH ENGINE OPTIMIZATION (search program optimization) is definitely the implementation involving techniques of which improve the volume and good quality of all 9 exam answers natural or organically grown traffic via search engine results to your web site. Website the SEARCH ENGINE RANKING OPTIMIZATION writer will be to create legible PMI-RMP Question and Answer content liberally sprinkled considering the chapter 5 exam answers 2019 key exam appeal ccna 1 exam SEARCH ENGINE OPTIMIZATION phrases seeing tshoot exam that required by client with out sacrificing the credibility of the portion. By providing a stellar example of various techniques CAS-002 Exam to get their own page ranks higher, the SEO in El Dorado’s own site provides confidence for their clients. The second key is that no one is really a SEARCH ENGINE OPTIMISATION expert. Launching a new service: Studying the search trends of potential customers in your area, using SEO tools like Google Trends for Exam Guide Search will allow you to see whether there’s a demand for your service in your local area.

Mão na massa Restful e Zend Framework 2

I hurried into the local department store Cisco 300-115 pdf to grab1 some last minute Chirsmas gifts. I looked at all the people and grumbled2 AWS-SYSOPS PDF to myself. I would be in here 300-101 pdf Cisco CCNA 100-105 Exam forever Cisco 300-115 pdf and I just Cisco 400-101 pdf had so much to do. Chirsmas was beginning to 100-105 dumps pdfs become such Cisco 300-115 pdf a drag. I kinda wished Cisco 400-101 pdf that I could just sleep through Chirsmas. Cisco CCNA 100-105 Exam But I hurried the best I could through all the people to the toy department. Once again Itcertpasses Cisco 400-101 pdf I kind of mumbled3 to myself at the prices of all these toys, and wondered if the 300-101 pdf grandkids would even play whit4 Itcertpasses Cisco CCNA 100-105 Exam them. I found myself in 100-105 dumps pdfs the doll aisle5. Out of the corner of my eye 100-105 dumps pdfs I saw a little boy about AWS-SYSOPS PDF 5 holding 100-105 dumps pdfs a Itcertpasses lovely doll.He Itcertpasses Cisco CCNA 100-105 Exam kept touching6 her Cisco 300-115 pdf hair and Cisco 300-115 pdf he held her so gently. I could not seem AWS-SYSOPS PDF to help myself. I 300-101 pdf just kept loking over at Cisco 400-101 pdf the little boy and wondered who the doll Cisco 300-115 pdf was for. Cisco CCNA 100-105 Exam I watched him Cisco 300-115 pdf AWS-SYSOPS PDF turn to a woman and he 100-105 dumps pdfs called his aunt by name and said, “Are you sure I don’t have enough money?” She replied a bit impatiently, “You know that you don’t have enough money 300-101 pdf for it.” 300-101 pdf The aunt told the little 300-101 pdf boy AWS-SYSOPS PDF 100-105 dumps pdfs not to go anywhere that she had to go and get some other things and would be back in a few minutes. And then she AWS-SYSOPS PDF left the aisle. The boy AWS-SYSOPS PDF continued to hold the doll. After a bit I asked the Cisco 400-101 pdf boy who the doll was for. He said, “It is the doll my sister wanted so badly for Cisco 300-115 pdf Chirsmas. She just knew that Cisco 300-115 pdf Santa would Cisco 400-101 pdf bring it. “I told 300-101 pdf him that maybe Santa was going to bring it . 300-101 pdf He 300-101 pdf said, “No, Cisco 300-115 pdf Itcertpasses Santa can’t go 300-101 pdf where my sister is…. I have to give the doll to my Mama to take to her. “I asked him where his siter 100-105 dumps pdfs was. He looked at Cisco 400-101 pdf me with the saddest eyes and said, “She was gone to be with Jesus.

My Daddy says that Mamma Cisco 300-115 pdf Itcertpasses is Itcertpasses going Itcertpasses to have to go be with her.” Itcertpasses My heart nearly stopped beating. Then the Cisco CCNA 100-105 Exam boy looked at me again and Cisco CCNA 100-105 Exam said, “I told my 100-105 dumps pdfs Daddy to tell 100-105 dumps pdfs my Mama not Cisco CCNA 100-105 Exam to go yet. I told him to Cisco 400-101 pdf tell her Cisco CCNA 100-105 Exam to wait till I got back from the store.” 100-105 dumps pdfs Then Cisco 400-101 pdf he asked me 300-101 pdf if i wanted to see his picture. I told him I’d love Cisco 300-115 pdf to. AWS-SYSOPS PDF He AWS-SYSOPS PDF pulled out 100-105 dumps pdfs some picture he’d had taken at the front of the store. He said, “I want my Mama to take this Itcertpasses with her so the dosen’t ever forget me. I love my Mama so very much and 300-101 pdf I wish she dind not have 300-101 pdf to leave me.But Daddy says AWS-SYSOPS PDF she will need to be with my sister.” I saw that the little boy had lowered his head and had grown so qiuet. Cisco CCNA 100-105 Exam While he was not looking I reached Cisco 400-101 pdf into my purse and 100-105 dumps pdfs pilled out a handful of bills. I asked the little boy, “Shall we count that miney Cisco 400-101 pdf one more time?” He grew excited and Cisco CCNA 100-105 Exam said, “Yes,I just Cisco 400-101 pdf know it has to be enough.” So Itcertpasses I slipped my money in with his and we began to count it Cisco 300-115 pdf . Of course it was plenty AWS-SYSOPS PDF AWS-SYSOPS PDF for the doll. He softly said, “Thank you 300-101 pdf Jesus for giving me enough Cisco CCNA 100-105 Exam money.” Then the boy Itcertpasses Cisco 300-115 pdf said, “I just asked Jesus to give me enough money to buy this doll so Mama can take Cisco 300-115 pdf it with her Itcertpasses to give my sister. And he heard my prayer. I wanted to ask him give for enough 300-101 pdf to buy my Mama a white rose, Cisco 400-101 pdf but Cisco 400-101 pdf I didn’t ask him, but he gave me enough to buy the doll AWS-SYSOPS PDF and a rose for my Mama. She loves white rose so much. “In Cisco 400-101 pdf a few minutes the aunt came back and I wheeled my cart away. I could not Cisco CCNA 100-105 Exam keep from thinking about the little boy as AWS-SYSOPS PDF 100-105 dumps pdfs I finished my shoppong in a ttally different 100-105 dumps pdfs spirit 100-105 dumps pdfs than when I had started. And I kept remembering a AWS-SYSOPS PDF story Cisco 400-101 pdf I had seen in the newspaper several days earlier about a drunk driver hitting Cisco CCNA 100-105 Exam a car and killing7 a AWS-SYSOPS PDF little girl and the Mother was in serious condition. The family was deciding on whether to remove the life support. Now surely this Itcertpasses little boy did Cisco CCNA 100-105 Exam not belong with that 100-105 dumps pdfs story.Two days later Cisco 300-115 pdf I read in the Cisco CCNA 100-105 Exam paper where the family had disconnected the life support and the young woman had died. I could not forget the little Itcertpasses boy and just kept wondering if the two Itcertpasses were somehow connected. Later that day, I could not help myself and I went out and bought aome white roses and took them to the funeral home where the yough woman was .And there she was holding a lovely white rose, the beautiful doll, and the picture of the 300-101 pdf little boy in the store. I left there in tears, thier life changed forever. The love that little boy had for his little sisiter and his mother was overwhel. And in a split8 second a drunk driver had ripped9 the life of that little boy to pieces.

Mais uma postagem da séria Mão na massa. Aqui vamos ter uma aplicação Restful usando Zend Framework 2, esse tipo de aplicação é largamente utilizada para criação de APIs e arquitetura SOA.

Particularmente eu gosto do Rest por ele ser simples, acredito que essa seja a maior vantagem dele. Muitas pessoas dizem que ele é pior do que o SOAP por questões de segurança e bla bla bla. Para você ter uma ideia, podemos usar o OAuth no Rest, acredito que isso seja o suficiente para mostrar que é seguro. Outro motivo é o fato de usar Json, eu simplesmente acho mais legal que XML, nada mais a declarar. 🙂

Depois de falar esse monte de besteiras para você, vamos ao escopo dessa mão na massa.
Fazer um sistema que leia um CEP informado e retorne o endereço completo, o retorno deve ser em JSon e XML.
Para isso vamos fazer algo bem tranquilo, vamos apenas retornar o método get($id), com os dados fixos em um array.

Se você não tiver um ambiente pronto, eu recomendo usar o Vagrant, aqui uma postagem sobre ele e uma de como configrar um servidor LAMP. Ou, você pode usar o servidor embutido:

php -S 0.0.0.0:8080 -t public/ public/index.php

Primeiramente vamos montar o ambiente de desenvolvimento usando o Skeleton que a Zend disponibiliza, eu tenho um fork dele na minha conta do github e é ele que vamos usar. Download Skeleton.

Depois de descompactar e deixar pronto para uso, vamos as modificações.

Sempre tenho problemas na versão do PHP, por isso vamos usar o Zend Framework 2.2, precisamos alterar o composer.

Agora vamos executar o composer

php composer.phar install

Assim que ele terminar de executar já podemos consultar o site, no meu caso http://localhost:8080.

restfullsample

Vamos definir que a nossa URL para fazer a consulta de CEP será “/api/cep[.:format]/[:CEP]”. Como exemplos:

http://localhost:8080/api/cep.json/06460000

ou

http://localhost:8080/api/cep.xml/06460000

Para fazer isso, precisamos criar uma rota na nossa aplicação para ela responder por esse endereço.

cepsample/module/Application/config/module.config.php (link GitHub)

return array(
    'router' => array(
        'routes' => array(
        ...
          'cep' => array(
              'type' => 'Segment',
              'options' => array(
                  'route' => '/api/cep[.:format]/[:id]',
                  'constraints' => array(
                      'format' => '(json)',
                  ),
                  'defaults' => array(
                      'controller' => 'Application\Controller\Cep',
                      'format' => 'json',
                  ),
              ),
          ),

No mesmo arquivo, procure o indíce “controllers”, ele deve se parecer com isso

'controllers' => array(
    'invokables' => array(
        'Application\Controller\Index' => 'Application\Controller\IndexController'
    ),
),

E deve ficar assim

'controllers' => array(
    'invokables' => array(
        'Application\Controller\Index' => 'Application\Controller\IndexController',
        'Application\Controller\Cep' => 'Application\Controller\CepController'
    ),
),

Com o redirect pronto, podemos iniciar a construção do método em Rest

No caminho “modules/Application/src/Application/Controller” crie um arquivo chamado “CepController.php”, ele deve ser assim:

Agora quando acessarmos a URL ele vai nos mostrar o array que foi definido no método get($id). Se não passarmos nada depois no CEP na URL, o retorno será em JSon, podemos passar XML também.

restfull_final_sample

Esse código por ser baixado pelo meu GitHub aqui.

Apigility e Doctrine 2

Hoje vou explicar como juntar o Doctrine 2 com o Apigility. Espero que isso ajude vocês da forma como me ajudou 🙂

Baixe o Apigility por aqui.
Depois de extrair o conteúdo, inicie o servidor.

php -S 0.0.0.0:8888 -t public public/index.php

Agora vamos criar uma API
Criar o serviço REST

Depois altere as configurações do aplicativo, a Entity precisa ser alterada
Local da Entity

Agora, vamos as configurações

Primeiro vamos adicionar o Doctrine 2 como dependência, isso pode ser feito de duas formas, diretamente no arquivo.

"doctrine/doctrine-orm-module" : "0.8.*"

ou

php composer.phar require "doctrine/doctrine-orm-module" "0.8.*"

Se você fez do primeiro jeito, atualize as dependências, pela segunda forma isso não é preciso.

php composer.phar update

Agora, precisamos adicionar os módulos do Doctrine 2 no application.config.php.

'DoctrineModule',
'DoctrineORMModule',

No module.config.php, adicione a configuração para que o zend processe o doctrine

'doctrine' => array(
    'driver' => array(
        'user_entities' => array(
            'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
            'cache' => 'array',
            'paths' => array(
                0 => __DIR__ . '/../src/User/Entity',
            ),
        ),
        'orm_default' => array(
            'drivers' => array(
                'User\Entity' => 'user_entities',
            ),
        ),
    ),
),

Para finalizar as configurações, crie o arquivo que configura a conexão com o banco e depois crie na pasta data/ um arquivo database.sqlite, ele é o seu banco de dados.

A entidade User precisa ser alterada de lugar, mova ela para /src/Entity e renomeie conforme gist.

Quando as configurações e a entidade estiver criada, falta gerar as tabelas.

php public/index.php orm:schema-tool:create

Caso seja preciso atualizar o banco de dados

php public/index.php orm:schema-tool:update --force

Agora altere os arquivos que o Apigility gerou

UserResource.php

UserCollection.php

UserResourceFactory.php

Como aqui é para teste, eu inseri um registo diretamente no banco, depois disso, só usar algum programa que faz post rest, eu uso o RESTClient do Firefox.

Executando o get list

http://localhost:8888/user

Get Collection

Executando o get

http://localhost:8888/user/1

Get ID

O código pode ser baixado pelo github aqui

Qualquer dúvida só mandar e-mail ou postar aqui.

Servidor LAMP

Hoje vou explicar como podemos criar um servidor LAMP. Essa postagem será útil se você utiliza o vagrant, sua máquina ou queria criar um servicor dentro da Amazon AWS, que é o ambiente que vamos utilizar.

Depois criarmos o servidor na AWS, precisamos acessar ele via SSH.
A primeira coisa que precisamos fazer é atualizar a lista de pacotes.

sudo apt-get update

Assim que terminar de atualizar os pocotes você pode dar início as instalações.

O primeiro passo é instalar o índio veio do Apache.

sudo apt-get install apache2

Agora, vamos a configuração de um site no apache. Com esse arquivo de exemplo, vamos montar o site.

Copie o conteúdo acima para o arquivo abaixo.

sudo nano /etc/apache2/sites-available/sample.conf

O servidor vai começar a responder para esse site apenas quando for ativado.

a2ensite sample.conf
sudo a2enmod rewrite
sudo service apache2 restart

O comando “sudo a2enmod rewrite” é para ativar o módulo de reescrita de URL do apache, ele é um adicional para o nosso caso, mas é obrigatório para o Zend, por esse motivo já coloquei ele aqui.

O segundo passo é o MySQL. Essa parte é sem segredos, vai executar o comando e ele vai pedir usuário e senha no processo.

sudo apt-get install mysql-server-5.5

Por fim, o PHP.

sudo apt-get install php5 php5-mysql

Aqui eu passei 2 pacotes para ele baixar, o “php5” é o PHP em si, o “php5-mysql” é o driver para do PHP para o MySQL.

Com tudo feito, fica assim:
Apache Sample